#include "AliMUONAlignmentCompareDialog.h"
#include "AliCDBManager.h"
#include "AliGeomManager.h"
#include "AliLog.h"
#include "AliMUON2DMap.h"
#include "AliMUONCalibParamND.h"
#include "AliMUONConstants.h"
#include "AliMUONGeometryTransformer.h"
#include "AliMUONPainterDataRegistry.h"
#include "AliMUONTrackerData.h"
#include "AliMUONTrackerDataWrapper.h"
#include "AliMpConstants.h"
#include "AliMpDDLStore.h"
#include "AliMpDEIterator.h"
#include "AliMpDetElement.h"
#include "AliMpManuIterator.h"
#include "AliMpPad.h"
#include "AliMpSegmentation.h"
#include "AliMpVPadIterator.h"
#include "AliMpVSegmentation.h"
#include <TGComboBox.h>
#include <TGLabel.h>
#include <TGNumberEntry.h>
#include <TGTextEntry.h>
#include <TGeoManager.h>
#include <TTimer.h>
ClassImp(AliMUONAlignmentCompareDialog)
namespace
{
#define PRECISION 1E-12
Double_t Difference(Double_t v1, Double_t v2)
{
Double_t d = v1-v2;
return TMath::Abs(d) < PRECISION ? 0.0 : d;
}
}
AliMUONAlignmentCompareDialog::AliMUONAlignmentCompareDialog(const TGWindow* p, const TGWindow* main, UInt_t w, UInt_t h)
: TGTransientFrame(p,main,w,h),
fF1(new TGVerticalFrame(this)),
fOCDBPath1(0x0),
fRun1(0x0),
fF2(new TGVerticalFrame(this)),
fOCDBPath2(0x0),
fRun2(0x0),
fF3(new TGHorizontalFrame(this)),
fBasename(new TGTextEntry(fF3)),
fButtonFrame(new TGHorizontalFrame(this)),
fOK(new TGTextButton(fButtonFrame,"OK")),
fCancel(new TGTextButton(fButtonFrame,"Cancel"))
{
SetCleanup(kDeepCleanup);
AddInput(fF1,"First alignment",fOCDBPath1,fRun1);
AddInput(fF2,"Second alignment",fOCDBPath2,fRun2);
fF3->AddFrame(new TGLabel(fF3,"Output basename"),new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
fF3->AddFrame(fBasename,new TGLayoutHints(kLHintsRight|kLHintsExpandX|kLHintsTop,5,5,5,5));
AddFrame(fF1,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
AddFrame(fF2,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
AddFrame(fF3,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
fButtonFrame->AddFrame(fOK,new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
fButtonFrame->AddFrame(fCancel,new TGLayoutHints(kLHintsRight|kLHintsTop,5,5,5,5));
AddFrame(fButtonFrame,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
fOK->Connect("Clicked()", "AliMUONAlignmentCompareDialog",this,"DoOK()");
fCancel->Connect("Clicked()","AliMUONAlignmentCompareDialog",this,"DoCancel()");
}
AliMUONAlignmentCompareDialog::~AliMUONAlignmentCompareDialog()
{
}
void AliMUONAlignmentCompareDialog::AddInput(TGCompositeFrame* frame, const char* msg,
TGTextEntry*& text, TGNumberEntry*& run)
{
TGHorizontalFrame* hf1 = new TGHorizontalFrame(frame);
hf1->AddFrame(new TGLabel(hf1,TString(msg) + " ocdb path"),new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
text = new TGTextEntry(hf1,"alien://folder=/alice/data/2012/OCDB");
hf1->AddFrame(text,new TGLayoutHints(kLHintsRight|kLHintsExpandX|kLHintsTop,5,5,5,5));
TGHorizontalFrame* hf2 = new TGHorizontalFrame(frame);
hf2->AddFrame(new TGLabel(hf2,TString(msg) + " run number"),new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
run = new TGNumberEntry(hf2);
hf2->AddFrame(run,new TGLayoutHints(kLHintsRight|kLHintsExpandX|kLHintsTop,5,5,5,5));
frame->AddFrame(hf1,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
frame->AddFrame(hf2,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
}
void
AliMUONAlignmentCompareDialog::DoOK()
{
AliMUONVTrackerData* d = CompareAlignment(fOCDBPath1->GetText(),fRun1->GetNumber(),
fOCDBPath2->GetText(),fRun2->GetNumber());
if (!d) return;
TString basename = fBasename->GetText();
AliMUONVTrackerDataMaker* dw = new AliMUONTrackerDataWrapper(d);
AliMUONPainterDataRegistry::Instance()->Register(dw);
TTimer::SingleShot(150,"AliMUONAlignmentCompareDialog",this,"CloseWindow()");
}
void
AliMUONAlignmentCompareDialog::DoCancel()
{
TTimer::SingleShot(150,"AliMUONAlignmentCompareDialog",this,"CloseWindow()");
}
AliMUONVTrackerData*
AliMUONAlignmentCompareDialog::CompareAlignment(const char* ocdbPathForAlign1, Int_t run1,
const char* ocdbPathForAlign2, Int_t run2)
{
AliCDBManager* cdbm = AliCDBManager::Instance();
cdbm->SetDefaultStorage("raw://");
AliMUONGeometryTransformer geoTransformer[2];
const char* align[2] = {
ocdbPathForAlign1,
ocdbPathForAlign2
};
Int_t runs[] = {
run1,run2
};
for (Int_t i = 0; i < 2; i++)
{
cdbm->UnloadFromCache("GRP/Geometry/Data");
cdbm->UnloadFromCache("MUON/Align/Data");
AliGeomManager::GetGeometry()->UnlockGeometry();
AliGeomManager::LoadGeometry();
if (!AliGeomManager::GetGeometry()) return 0x0;
cdbm->SetSpecificStorage("MUON/Align/Data",align[i]);
cdbm->SetRun(runs[i]);
AliGeomManager::ApplyAlignObjsFromCDB("MUON");
geoTransformer[i].LoadGeometryData();
}
AliMUON2DMap shiftStore(kTRUE);
for (Int_t iCh = 0; iCh < AliMUONConstants::NTrackingCh(); iCh++) {
AliMpDEIterator nextDE;
nextDE.First(iCh);
while (!nextDE.IsDone()) {
Int_t deId = nextDE.CurrentDE()->GetId();
for (Int_t icath = 0; icath < 2; icath++) {
const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(deId,AliMp::GetCathodType(icath));
AliMpVPadIterator *nextPad = seg->CreateIterator();
nextPad->First();
while (!nextPad->IsDone()) {
AliMpPad pad = nextPad->CurrentItem();
Int_t manuId = pad.GetManuId();
Int_t manuChannel = pad.GetManuChannel();
Double_t xl = pad.GetPositionX();
Double_t yl = pad.GetPositionY();
Double_t zl = 0.;
Double_t x1, y1, z1;
geoTransformer[0].Local2Global(deId,xl,yl,zl,x1,y1,z1);
Double_t x2, y2, z2;
geoTransformer[1].Local2Global(deId,xl,yl,zl,x2,y2,z2);
Double_t dx = ::Difference(x2,x1);
Double_t dy = ::Difference(y2,y1);
Double_t dz = ::Difference(z2,z1);
AliMUONVCalibParam* p = static_cast<AliMUONVCalibParam*>(shiftStore.FindObject(deId,manuId));
if (!p) {
p = new AliMUONCalibParamND(3,AliMpConstants::ManuNofChannels(),deId,manuId,0.);
shiftStore.Add(p);
}
p->SetValueAsDouble(manuChannel,0,dx);
p->SetValueAsDouble(manuChannel,1,dy);
p->SetValueAsDouble(manuChannel,2,dz);
nextPad->Next();
}
delete nextPad;
}
nextDE.Next();
}
}
AliMUONTrackerData* data = new AliMUONTrackerData(fBasename->GetText(),fBasename->GetText(),3,kTRUE);
data->SetDimensionName(0,"dx");
data->SetDimensionName(1,"dy");
data->SetDimensionName(2,"dz");
data->Add(shiftStore);
return data;
AliMUONAlignmentCompareDialog.cxx:1 AliMUONAlignmentCompareDialog.cxx:2 AliMUONAlignmentCompareDialog.cxx:3 AliMUONAlignmentCompareDialog.cxx:4 AliMUONAlignmentCompareDialog.cxx:5 AliMUONAlignmentCompareDialog.cxx:6 AliMUONAlignmentCompareDialog.cxx:7 AliMUONAlignmentCompareDialog.cxx:8 AliMUONAlignmentCompareDialog.cxx:9 AliMUONAlignmentCompareDialog.cxx:10 AliMUONAlignmentCompareDialog.cxx:11 AliMUONAlignmentCompareDialog.cxx:12 AliMUONAlignmentCompareDialog.cxx:13 AliMUONAlignmentCompareDialog.cxx:14 AliMUONAlignmentCompareDialog.cxx:15 AliMUONAlignmentCompareDialog.cxx:16 AliMUONAlignmentCompareDialog.cxx:17 AliMUONAlignmentCompareDialog.cxx:18 AliMUONAlignmentCompareDialog.cxx:19 AliMUONAlignmentCompareDialog.cxx:20 AliMUONAlignmentCompareDialog.cxx:21 AliMUONAlignmentCompareDialog.cxx:22 AliMUONAlignmentCompareDialog.cxx:23 AliMUONAlignmentCompareDialog.cxx:24 AliMUONAlignmentCompareDialog.cxx:25 AliMUONAlignmentCompareDialog.cxx:26 AliMUONAlignmentCompareDialog.cxx:27 AliMUONAlignmentCompareDialog.cxx:28 AliMUONAlignmentCompareDialog.cxx:29 AliMUONAlignmentCompareDialog.cxx:30 AliMUONAlignmentCompareDialog.cxx:31 AliMUONAlignmentCompareDialog.cxx:32 AliMUONAlignmentCompareDialog.cxx:33 AliMUONAlignmentCompareDialog.cxx:34 AliMUONAlignmentCompareDialog.cxx:35 AliMUONAlignmentCompareDialog.cxx:36 AliMUONAlignmentCompareDialog.cxx:37 AliMUONAlignmentCompareDialog.cxx:38 AliMUONAlignmentCompareDialog.cxx:39 AliMUONAlignmentCompareDialog.cxx:40 AliMUONAlignmentCompareDialog.cxx:41 AliMUONAlignmentCompareDialog.cxx:42 AliMUONAlignmentCompareDialog.cxx:43 AliMUONAlignmentCompareDialog.cxx:44 AliMUONAlignmentCompareDialog.cxx:45 AliMUONAlignmentCompareDialog.cxx:46 AliMUONAlignmentCompareDialog.cxx:47 AliMUONAlignmentCompareDialog.cxx:48 AliMUONAlignmentCompareDialog.cxx:49 AliMUONAlignmentCompareDialog.cxx:50 AliMUONAlignmentCompareDialog.cxx:51 AliMUONAlignmentCompareDialog.cxx:52 AliMUONAlignmentCompareDialog.cxx:53 AliMUONAlignmentCompareDialog.cxx:54 AliMUONAlignmentCompareDialog.cxx:55 AliMUONAlignmentCompareDialog.cxx:56 AliMUONAlignmentCompareDialog.cxx:57 AliMUONAlignmentCompareDialog.cxx:58 AliMUONAlignmentCompareDialog.cxx:59 AliMUONAlignmentCompareDialog.cxx:60 AliMUONAlignmentCompareDialog.cxx:61 AliMUONAlignmentCompareDialog.cxx:62 AliMUONAlignmentCompareDialog.cxx:63 AliMUONAlignmentCompareDialog.cxx:64 AliMUONAlignmentCompareDialog.cxx:65 AliMUONAlignmentCompareDialog.cxx:66 AliMUONAlignmentCompareDialog.cxx:67 AliMUONAlignmentCompareDialog.cxx:68 AliMUONAlignmentCompareDialog.cxx:69 AliMUONAlignmentCompareDialog.cxx:70 AliMUONAlignmentCompareDialog.cxx:71 AliMUONAlignmentCompareDialog.cxx:72 AliMUONAlignmentCompareDialog.cxx:73 AliMUONAlignmentCompareDialog.cxx:74 AliMUONAlignmentCompareDialog.cxx:75 AliMUONAlignmentCompareDialog.cxx:76 AliMUONAlignmentCompareDialog.cxx:77 AliMUONAlignmentCompareDialog.cxx:78 AliMUONAlignmentCompareDialog.cxx:79 AliMUONAlignmentCompareDialog.cxx:80 AliMUONAlignmentCompareDialog.cxx:81 AliMUONAlignmentCompareDialog.cxx:82 AliMUONAlignmentCompareDialog.cxx:83 AliMUONAlignmentCompareDialog.cxx:84 AliMUONAlignmentCompareDialog.cxx:85 AliMUONAlignmentCompareDialog.cxx:86 AliMUONAlignmentCompareDialog.cxx:87 AliMUONAlignmentCompareDialog.cxx:88 AliMUONAlignmentCompareDialog.cxx:89 AliMUONAlignmentCompareDialog.cxx:90 AliMUONAlignmentCompareDialog.cxx:91 AliMUONAlignmentCompareDialog.cxx:92 AliMUONAlignmentCompareDialog.cxx:93 AliMUONAlignmentCompareDialog.cxx:94 AliMUONAlignmentCompareDialog.cxx:95 AliMUONAlignmentCompareDialog.cxx:96 AliMUONAlignmentCompareDialog.cxx:97 AliMUONAlignmentCompareDialog.cxx:98 AliMUONAlignmentCompareDialog.cxx:99 AliMUONAlignmentCompareDialog.cxx:100 AliMUONAlignmentCompareDialog.cxx:101 AliMUONAlignmentCompareDialog.cxx:102 AliMUONAlignmentCompareDialog.cxx:103 AliMUONAlignmentCompareDialog.cxx:104 AliMUONAlignmentCompareDialog.cxx:105 AliMUONAlignmentCompareDialog.cxx:106 AliMUONAlignmentCompareDialog.cxx:107 AliMUONAlignmentCompareDialog.cxx:108 AliMUONAlignmentCompareDialog.cxx:109 AliMUONAlignmentCompareDialog.cxx:110 AliMUONAlignmentCompareDialog.cxx:111 AliMUONAlignmentCompareDialog.cxx:112 AliMUONAlignmentCompareDialog.cxx:113 AliMUONAlignmentCompareDialog.cxx:114 AliMUONAlignmentCompareDialog.cxx:115 AliMUONAlignmentCompareDialog.cxx:116 AliMUONAlignmentCompareDialog.cxx:117 AliMUONAlignmentCompareDialog.cxx:118 AliMUONAlignmentCompareDialog.cxx:119 AliMUONAlignmentCompareDialog.cxx:120 AliMUONAlignmentCompareDialog.cxx:121 AliMUONAlignmentCompareDialog.cxx:122 AliMUONAlignmentCompareDialog.cxx:123 AliMUONAlignmentCompareDialog.cxx:124 AliMUONAlignmentCompareDialog.cxx:125 AliMUONAlignmentCompareDialog.cxx:126 AliMUONAlignmentCompareDialog.cxx:127 AliMUONAlignmentCompareDialog.cxx:128 AliMUONAlignmentCompareDialog.cxx:129 AliMUONAlignmentCompareDialog.cxx:130 AliMUONAlignmentCompareDialog.cxx:131 AliMUONAlignmentCompareDialog.cxx:132 AliMUONAlignmentCompareDialog.cxx:133 AliMUONAlignmentCompareDialog.cxx:134 AliMUONAlignmentCompareDialog.cxx:135 AliMUONAlignmentCompareDialog.cxx:136 AliMUONAlignmentCompareDialog.cxx:137 AliMUONAlignmentCompareDialog.cxx:138 AliMUONAlignmentCompareDialog.cxx:139 AliMUONAlignmentCompareDialog.cxx:140 AliMUONAlignmentCompareDialog.cxx:141 AliMUONAlignmentCompareDialog.cxx:142 AliMUONAlignmentCompareDialog.cxx:143 AliMUONAlignmentCompareDialog.cxx:144 AliMUONAlignmentCompareDialog.cxx:145 AliMUONAlignmentCompareDialog.cxx:146 AliMUONAlignmentCompareDialog.cxx:147 AliMUONAlignmentCompareDialog.cxx:148 AliMUONAlignmentCompareDialog.cxx:149 AliMUONAlignmentCompareDialog.cxx:150 AliMUONAlignmentCompareDialog.cxx:151 AliMUONAlignmentCompareDialog.cxx:152 AliMUONAlignmentCompareDialog.cxx:153 AliMUONAlignmentCompareDialog.cxx:154 AliMUONAlignmentCompareDialog.cxx:155 AliMUONAlignmentCompareDialog.cxx:156 AliMUONAlignmentCompareDialog.cxx:157 AliMUONAlignmentCompareDialog.cxx:158 AliMUONAlignmentCompareDialog.cxx:159 AliMUONAlignmentCompareDialog.cxx:160 AliMUONAlignmentCompareDialog.cxx:161 AliMUONAlignmentCompareDialog.cxx:162 AliMUONAlignmentCompareDialog.cxx:163 AliMUONAlignmentCompareDialog.cxx:164 AliMUONAlignmentCompareDialog.cxx:165 AliMUONAlignmentCompareDialog.cxx:166 AliMUONAlignmentCompareDialog.cxx:167 AliMUONAlignmentCompareDialog.cxx:168 AliMUONAlignmentCompareDialog.cxx:169 AliMUONAlignmentCompareDialog.cxx:170 AliMUONAlignmentCompareDialog.cxx:171 AliMUONAlignmentCompareDialog.cxx:172 AliMUONAlignmentCompareDialog.cxx:173 AliMUONAlignmentCompareDialog.cxx:174 AliMUONAlignmentCompareDialog.cxx:175 AliMUONAlignmentCompareDialog.cxx:176 AliMUONAlignmentCompareDialog.cxx:177 AliMUONAlignmentCompareDialog.cxx:178 AliMUONAlignmentCompareDialog.cxx:179 AliMUONAlignmentCompareDialog.cxx:180 AliMUONAlignmentCompareDialog.cxx:181 AliMUONAlignmentCompareDialog.cxx:182 AliMUONAlignmentCompareDialog.cxx:183 AliMUONAlignmentCompareDialog.cxx:184 AliMUONAlignmentCompareDialog.cxx:185 AliMUONAlignmentCompareDialog.cxx:186 AliMUONAlignmentCompareDialog.cxx:187 AliMUONAlignmentCompareDialog.cxx:188 AliMUONAlignmentCompareDialog.cxx:189 AliMUONAlignmentCompareDialog.cxx:190 AliMUONAlignmentCompareDialog.cxx:191 AliMUONAlignmentCompareDialog.cxx:192 AliMUONAlignmentCompareDialog.cxx:193 AliMUONAlignmentCompareDialog.cxx:194 AliMUONAlignmentCompareDialog.cxx:195 AliMUONAlignmentCompareDialog.cxx:196 AliMUONAlignmentCompareDialog.cxx:197 AliMUONAlignmentCompareDialog.cxx:198 AliMUONAlignmentCompareDialog.cxx:199 AliMUONAlignmentCompareDialog.cxx:200 AliMUONAlignmentCompareDialog.cxx:201 AliMUONAlignmentCompareDialog.cxx:202 AliMUONAlignmentCompareDialog.cxx:203 AliMUONAlignmentCompareDialog.cxx:204 AliMUONAlignmentCompareDialog.cxx:205 AliMUONAlignmentCompareDialog.cxx:206 AliMUONAlignmentCompareDialog.cxx:207 AliMUONAlignmentCompareDialog.cxx:208 AliMUONAlignmentCompareDialog.cxx:209 AliMUONAlignmentCompareDialog.cxx:210 AliMUONAlignmentCompareDialog.cxx:211 AliMUONAlignmentCompareDialog.cxx:212 AliMUONAlignmentCompareDialog.cxx:213 AliMUONAlignmentCompareDialog.cxx:214 AliMUONAlignmentCompareDialog.cxx:215 AliMUONAlignmentCompareDialog.cxx:216 AliMUONAlignmentCompareDialog.cxx:217 AliMUONAlignmentCompareDialog.cxx:218 AliMUONAlignmentCompareDialog.cxx:219 AliMUONAlignmentCompareDialog.cxx:220 AliMUONAlignmentCompareDialog.cxx:221 AliMUONAlignmentCompareDialog.cxx:222 AliMUONAlignmentCompareDialog.cxx:223 AliMUONAlignmentCompareDialog.cxx:224 AliMUONAlignmentCompareDialog.cxx:225 AliMUONAlignmentCompareDialog.cxx:226 AliMUONAlignmentCompareDialog.cxx:227 AliMUONAlignmentCompareDialog.cxx:228 AliMUONAlignmentCompareDialog.cxx:229 AliMUONAlignmentCompareDialog.cxx:230 AliMUONAlignmentCompareDialog.cxx:231 AliMUONAlignmentCompareDialog.cxx:232 AliMUONAlignmentCompareDialog.cxx:233 AliMUONAlignmentCompareDialog.cxx:234 AliMUONAlignmentCompareDialog.cxx:235 AliMUONAlignmentCompareDialog.cxx:236 AliMUONAlignmentCompareDialog.cxx:237 AliMUONAlignmentCompareDialog.cxx:238 AliMUONAlignmentCompareDialog.cxx:239 AliMUONAlignmentCompareDialog.cxx:240 AliMUONAlignmentCompareDialog.cxx:241 AliMUONAlignmentCompareDialog.cxx:242 AliMUONAlignmentCompareDialog.cxx:243 AliMUONAlignmentCompareDialog.cxx:244 AliMUONAlignmentCompareDialog.cxx:245 AliMUONAlignmentCompareDialog.cxx:246 AliMUONAlignmentCompareDialog.cxx:247 AliMUONAlignmentCompareDialog.cxx:248 AliMUONAlignmentCompareDialog.cxx:249 AliMUONAlignmentCompareDialog.cxx:250 AliMUONAlignmentCompareDialog.cxx:251 AliMUONAlignmentCompareDialog.cxx:252 AliMUONAlignmentCompareDialog.cxx:253 AliMUONAlignmentCompareDialog.cxx:254 AliMUONAlignmentCompareDialog.cxx:255 AliMUONAlignmentCompareDialog.cxx:256 AliMUONAlignmentCompareDialog.cxx:257 AliMUONAlignmentCompareDialog.cxx:258 AliMUONAlignmentCompareDialog.cxx:259 AliMUONAlignmentCompareDialog.cxx:260 AliMUONAlignmentCompareDialog.cxx:261 AliMUONAlignmentCompareDialog.cxx:262 AliMUONAlignmentCompareDialog.cxx:263 AliMUONAlignmentCompareDialog.cxx:264 AliMUONAlignmentCompareDialog.cxx:265 AliMUONAlignmentCompareDialog.cxx:266 AliMUONAlignmentCompareDialog.cxx:267 AliMUONAlignmentCompareDialog.cxx:268 AliMUONAlignmentCompareDialog.cxx:269 AliMUONAlignmentCompareDialog.cxx:270 AliMUONAlignmentCompareDialog.cxx:271 AliMUONAlignmentCompareDialog.cxx:272 AliMUONAlignmentCompareDialog.cxx:273 AliMUONAlignmentCompareDialog.cxx:274