8 #if !defined(__CINT__) || defined(__MAKECINT__)
12 #include <TStopwatch.h>
13 #include <TMultiGraph.h>
16 #include <TGraphErrors.h>
25 #include <THashList.h>
26 #include <TFileCollection.h>
27 #include <TAlienCollection.h>
28 #include <TGridCollection.h>
29 #include <TGridResult.h>
33 #include "AliCDBManager.h"
34 #include "AliAnalysisManager.h"
35 #include "AliESDInputHandler.h"
36 #include "AliTagAnalysis.h"
37 #include "AliRunTagCuts.h"
38 #include "AliLHCTagCuts.h"
39 #include "AliDetectorTagCuts.h"
40 #include "AliEventTagCuts.h"
41 #include "AliAnalysisDataContainer.h"
44 #include "AliPhysicsSelectionTask.h"
45 #include "AliPhysicsSelection.h"
46 #include "AliBackgroundSelection.h"
47 #include "AliCentralitySelectionTask.h"
52 #include "AliMpDetElement.h"
53 #include "AliMpDDLStore.h"
54 #include "AliMUONCalibParamND.h"
55 #include "AliMUON2DMap.h"
56 #include "AliMUONTrackerData.h"
57 #include "AliMUONPainterDataRegistry.h"
58 #include "AliMUONTrackerDataWrapper.h"
60 #include "AliMuonEventCuts.h"
61 #include "AliMuonTrackCuts.h"
108 nSteps = TMath::Max(nSteps,1);
109 if (extrapMode != 0 && extrapMode != 1) {
110 Error(
"MuonResolution",
"incorrect extrapolation mode!");
117 Error(
"MuonResolution",
"Please provide either an ESD root file, a list of ESDs, a collection of ESDs or a dataset.");
122 Double_t clusterResNB[10] = {-1., -1., -1., -1., -1., -1., -1., -1., -1., -1.};
123 Double_t clusterResB[10] = {-1., -1., -1., -1., -1., -1., -1., -1., -1., -1.};
124 Double_t clusterResNBErr[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
125 Double_t clusterResBErr[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
126 Double_t halfChShiftNB[20] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
127 Double_t halfChShiftB[20] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
128 Double_t halfChShiftNBErr[20] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
129 Double_t halfChShiftBErr[20] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
132 for (
Int_t i=0; i<200; i++) {
138 TMultiGraph* mgClusterResXVsStep =
new TMultiGraph(
"mgClusterResXVsStep",
"cluster X-resolution versus step;step;#sigma_{X} (cm)");
139 TMultiGraph* mgClusterResYVsStep =
new TMultiGraph(
"mgClusterResYVsStep",
"cluster Y-resolution versus step;step;#sigma_{Y} (cm)");
142 for (
Int_t i = 0; i < 10; i++) {
144 clusterResXVsStep[i]->SetName(Form(
"gResX_ch%d",i+1));
145 clusterResXVsStep[i]->SetMarkerStyle(kFullDotMedium);
146 clusterResXVsStep[i]->SetMarkerColor(i+1+i/9);
147 mgClusterResXVsStep->Add(clusterResXVsStep[i],
"lp");
150 clusterResYVsStep[i]->SetName(Form(
"gResY_ch%d",i+1));
151 clusterResYVsStep[i]->SetMarkerStyle(kFullDotMedium);
152 clusterResYVsStep[i]->SetMarkerColor(i+1+i/9);
153 mgClusterResYVsStep->Add(clusterResYVsStep[i],
"lp");
155 TMultiGraph* mgHalfChShiftXVsStep =
new TMultiGraph(
"mgHalfChShiftXVsStep",
"half-chamber displacement in X direction versus step;step;#Delta_{X} (cm)");
156 TMultiGraph* mgHalfChShiftYVsStep =
new TMultiGraph(
"mgHalfChShiftYVsStep",
"half-chamber displacement in Y direction versus step;step;#Delta_{Y} (cm)");
159 for (
Int_t i = 0; i < 20; i++) {
161 halfChShiftXVsStep[i]->SetName(Form(
"gShiftX_hch%d",i+1));
162 halfChShiftXVsStep[i]->SetMarkerStyle(kFullDotMedium);
163 halfChShiftXVsStep[i]->SetMarkerColor(i+1+i/9+i/18);
164 mgHalfChShiftXVsStep->Add(halfChShiftXVsStep[i],
"lp");
165 halfChShiftXVsStep[i]->SetPoint(0, 0, halfChShiftNB[i]);
166 halfChShiftXVsStep[i]->SetPointError(0, 0., halfChShiftNBErr[i]);
169 halfChShiftYVsStep[i]->SetName(Form(
"gShiftY_hch%d",i+1));
170 halfChShiftYVsStep[i]->SetMarkerStyle(kFullDotMedium);
171 halfChShiftYVsStep[i]->SetMarkerColor(i+1+i/9+i/18);
172 mgHalfChShiftYVsStep->Add(halfChShiftYVsStep[i],
"lp");
173 halfChShiftYVsStep[i]->SetPoint(0, 0, halfChShiftB[i]);
174 halfChShiftYVsStep[i]->SetPointError(0, 0., halfChShiftBErr[i]);
180 if (!
gSystem->Exec(
"ls chamberResolution_step*[0-9].root")) {
181 cout<<
"Above files already exist in the current directory. [d=delete, r=resume, e=exit] "<<flush;
182 while (
remove !=
'd' &&
remove !=
'r' &&
remove !=
'e') cin>>
remove;
183 if (
remove ==
'y')
gSystem->Exec(
"rm -f chamberResolution_step*[0-9].root");
184 else if (
remove ==
'r' && !
Resume(firstStep, clusterResNB, clusterResB, clusterResNBErr, clusterResBErr,
185 shiftHalfCh, halfChShiftNB, halfChShiftB, halfChShiftNBErr, halfChShiftBErr,
186 shiftDE, deShiftNB, deShiftB, clusterResXVsStep, clusterResYVsStep,
187 halfChShiftXVsStep, halfChShiftYVsStep))
return;
188 else if (
remove ==
'e')
return;
194 if (inputFileName.EndsWith(
".root")) {
195 TFile *inFile = TFile::Open(inputFileName.Data(),
"READ");
196 if (inFile && inFile->IsOpen()) {
197 inputObj =
dynamic_cast<TFileCollection*
>(inFile->FindObjectAny(
"dataset"));
200 }
else inputObj =
new TObjString(inputFileName);
201 }
else inputObj =
CreateChain(mode, inputFileName);
202 if (!inputObj)
return;
205 for (
Int_t iStep = firstStep; iStep < nSteps; iStep++) {
206 cout<<
"step "<<iStep+1<<
"/"<<nSteps<<endl;
213 applyAccCut, applyPDCACut, minMomentum, minPt, isMC,
214 correctForSystematics, extrapMode, clusterResNB, clusterResB,
215 shiftHalfCh, halfChShiftNB, halfChShiftB, shiftDE, deShiftNB, deShiftB);
216 if (!muonResolution)
return;
220 if (mgr->InitAnalysis()) {
223 if (inputObj->IsA() == TFileCollection::Class())
224 mgr->StartAnalysis(
"proof", static_cast<TFileCollection*>(inputObj), nevents);
225 else mgr->StartAnalysis(
"proof", static_cast<TObjString*>(inputObj)->GetName(), nevents);
226 }
else mgr->StartAnalysis(
"local", static_cast<TChain*>(inputObj), nevents);
231 TFile* outFile = TFile::Open(Form(
"chamberResolution_step%d.root", iStep),
"UPDATE");
232 if (outFile && outFile->IsOpen()) {
244 for (
Int_t i = 0; i < 10; i++) {
245 clusterResXVsStep[i]->SetPoint(0, 0, clusterResNB[i]);
246 clusterResXVsStep[i]->SetPointError(0, 0., clusterResNBErr[i]);
247 clusterResYVsStep[i]->SetPoint(0, 0, clusterResB[i]);
248 clusterResYVsStep[i]->SetPointError(0, 0., clusterResBErr[i]);
253 if (!
GetChamberResolution(iStep, clusterResNB, clusterResB, clusterResNBErr, clusterResBErr))
return;
256 for (
Int_t i = 0; i < 10; i++) {
257 clusterResXVsStep[i]->SetPoint(iStep+1, iStep+1, clusterResNB[i]);
258 clusterResXVsStep[i]->SetPointError(iStep+1, 0., clusterResNBErr[i]);
259 clusterResYVsStep[i]->SetPoint(iStep+1, iStep+1, clusterResB[i]);
260 clusterResYVsStep[i]->SetPointError(iStep+1, 0., clusterResBErr[i]);
265 if (!
AddHalfChShift(iStep, halfChShiftNB, halfChShiftB, halfChShiftNBErr, halfChShiftBErr))
return;
268 for (
Int_t i = 0; i < 20; i++) {
269 halfChShiftXVsStep[i]->SetPoint(iStep+1, iStep+1, halfChShiftNB[i]);
270 halfChShiftXVsStep[i]->SetPointError(iStep+1, 0., halfChShiftNBErr[i]);
271 halfChShiftYVsStep[i]->SetPoint(iStep+1, iStep+1, halfChShiftB[i]);
272 halfChShiftYVsStep[i]->SetPointError(iStep+1, 0., halfChShiftBErr[i]);
276 muonResolution->
GetDEShift(deShiftNB, deShiftB);
277 if (!
AddDEShift(iStep, deShiftNB, deShiftB))
return;
280 mgr->SetAnalysisType(AliAnalysisManager::kLocalAnalysis);
282 TObject::SetObjectStat(kFALSE);
287 gSystem->Exec(Form(
"cp chamberResolution_step%d.root results.root", nSteps-1));
290 TCanvas* convergence1 =
new TCanvas(
"convergenceRes",
"convergence of cluster resolution");
291 convergence1->Divide(1,2);
293 mgClusterResXVsStep->Draw(
"ap");
295 mgClusterResYVsStep->Draw(
"ap");
298 TCanvas* convergence2 =
new TCanvas(
"convergenceShift",
"convergence of half-chamber displacements");
299 convergence2->Divide(1,2);
301 mgHalfChShiftXVsStep->Draw(
"ap");
303 mgHalfChShiftYVsStep->Draw(
"ap");
306 TFile* outFile = TFile::Open(
"results.root",
"UPDATE");
307 if (!outFile || !outFile->IsOpen())
return;
309 mgClusterResXVsStep->Write();
310 mgClusterResYVsStep->Write();
311 convergence1->Write();
312 mgHalfChShiftXVsStep->Write();
313 mgHalfChShiftYVsStep->Write();
314 convergence2->Write();
319 printf(
"\nhalf-chamber total displacements:\n");
320 printf(
" - non-bending:");
321 for (
Int_t i = 0; i < 20; i++) printf((i==0)?
" %6.4f":
", %6.4f", halfChShiftNB[i]);
322 printf(
"\n - bending:");
323 for (
Int_t i = 0; i < 20; i++) printf((i==0)?
" %6.4f":
", %6.4f", halfChShiftB[i]);
327 printf(
"\nDE total displacements:\n");
328 printf(
" - non-bending:");
329 for (
Int_t i = 0; i <
nDE; i++) printf((i==0)?
" %6.4f":
", %6.4f", deShiftNB[i]);
330 printf(
"\n - bending:");
331 for (
Int_t i = 0; i <
nDE; i++) printf((i==0)?
" %6.4f":
", %6.4f", deShiftB[i]);
355 cout<<
"From which step (included) you want to resume? [#, e=exit] "<<flush;
357 do {step.Gets(stdin,kTRUE);}
while (!step.IsDigit() && step !=
"e");
358 if (step ==
"e")
return kFALSE;
359 firstStep = step.Atoi();
362 if (firstStep == 0) {
363 gSystem->Exec(
"rm -f chamberResolution_step*[0-9].root");
368 if (
gSystem->AccessPathName(Form(
"chamberResolution_step%d.root", firstStep-1))) {
369 cout<<
"No result found from the previous step ("<<firstStep-1<<
"). Unable to resume from step "<<firstStep<<endl;
374 for (
Int_t i = 0; i < 10; i++) {
375 clusterResXVsStep[i]->SetPoint(0, 0, clusterResNB[i]);
376 clusterResXVsStep[i]->SetPointError(0, 0., clusterResNBErr[i]);
377 clusterResYVsStep[i]->SetPoint(0, 0, clusterResB[i]);
378 clusterResYVsStep[i]->SetPointError(0, 0., clusterResBErr[i]);
382 Bool_t missingInfo = kFALSE;
383 for (
Int_t iStep = 0; iStep < firstStep; iStep++) {
386 if (!
GetChamberResolution(iStep, clusterResNB, clusterResB, clusterResNBErr, clusterResBErr) && iStep == firstStep-1) {
392 for (
Int_t i = 0; i < 10; i++) {
393 clusterResXVsStep[i]->SetPoint(iStep+1, iStep+1, clusterResNB[i]);
394 clusterResXVsStep[i]->SetPointError(iStep+1, 0., clusterResNBErr[i]);
395 clusterResYVsStep[i]->SetPoint(iStep+1, iStep+1, clusterResB[i]);
396 clusterResYVsStep[i]->SetPointError(iStep+1, 0., clusterResBErr[i]);
400 if (!shiftHalfCh)
for (
Int_t i=0; i<20; i++) {
401 halfChShiftNB[i] = 0.; halfChShiftB[i] = 0.;
402 halfChShiftNBErr[i] = 0.; halfChShiftBErr[i] = 0.;
404 if (!
AddHalfChShift(iStep, halfChShiftNB, halfChShiftB, halfChShiftNBErr, halfChShiftBErr) && shiftHalfCh) {
410 for (
Int_t i = 0; i < 20; i++) {
411 halfChShiftXVsStep[i]->SetPoint(iStep+1, iStep+1, halfChShiftNB[i]);
412 halfChShiftXVsStep[i]->SetPointError(iStep+1, 0., halfChShiftNBErr[i]);
413 halfChShiftYVsStep[i]->SetPoint(iStep+1, iStep+1, halfChShiftB[i]);
414 halfChShiftYVsStep[i]->SetPointError(iStep+1, 0., halfChShiftBErr[i]);
418 if (shiftDE && !
AddDEShift(iStep, deShiftNB, deShiftB)) {
426 if (missingInfo)
continue;
429 gSystem->Exec(
"mkdir __TMP__");
430 for (
Int_t iStep = 0; iStep < firstStep; iStep++)
431 if (!
gSystem->AccessPathName(Form(
"chamberResolution_step%d.root", iStep)))
432 gSystem->Exec(Form(
"mv chamberResolution_step%d.root __TMP__", iStep));
433 gSystem->Exec(
"rm -f chamberResolution_step*[0-9].root");
434 gSystem->Exec(
"mv __TMP__/chamberResolution_step*[0-9].root .");
435 gSystem->Exec(
"rm -rf __TMP__");
448 if (iStep == 0) gEnv->SetValue(
"XSec.GSI.DelegProxy",
"2");
449 else gProof->Close(
"s");
452 if (aaf ==
"saf3") TProof::Open(
"pod://");
454 TString location = (aaf ==
"caf") ?
"alice-caf.cern.ch" :
"nansafmaster2.in2p3.fr";
455 TString nWorkers = (aaf ==
"caf") ?
"workers=80" :
"";
456 TString user = (
gSystem->Getenv(
"alien_API_USER") == NULL) ?
"" : Form(
"%s@",
gSystem->Getenv(
"alien_API_USER"));
457 TProof::Mgr(Form(
"%s%s",user.Data(), location.Data()))->SetROOTVersion(Form(
"VO_ALICE@ROOT::%s",rootVersion.Data()));
458 TProof::Open(Form(
"%s%s/?N",user.Data(), location.Data()), nWorkers.Data());
464 list->Add(
new TNamed(
"ALIROOT_MODE",
"base"));
465 list->Add(
new TNamed(
"ALIROOT_ENABLE_ALIEN",
"1"));
468 gProof->UploadPackage(Form(
"%s/AliceVaf.par", home.Data()));
469 gProof->EnablePackage(Form(
"%s/AliceVaf.par", home.Data()), list, (iStep!=0));
470 }
else gProof->EnablePackage(Form(
"VO_ALICE@AliPhysics::%s",aliphysicsVersion.Data()), list, kTRUE);
494 AliESDInputHandler* esdH =
new AliESDInputHandler();
495 esdH->SetReadFriends(kFALSE);
496 esdH->SetInactiveBranches(
"*");
497 esdH->SetActiveBranches(
"MuonTracks MuonClusters MuonPads AliESDRun. AliESDHeader. AliMultiplicity. AliESDFMD. AliESDVZERO. SPDVertex. PrimaryVertex. AliESDZDC.");
498 mgr->SetInputEventHandler(esdH);
501 UInt_t eventSelectionMask = 0;
503 gROOT->LoadMacro(
"$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
504 AliPhysicsSelectionTask* physicsSelection =
reinterpret_cast<AliPhysicsSelectionTask*
>(gROOT->ProcessLineSync(TString::Format(
"AddTaskPhysicsSelection(%d)", isMC)));
505 if (!physicsSelection) {
506 Error(
"CreateAnalysisTrain",
"AliPhysicsSelectionTask not created!");
510 eventSelectionMask |= AliMuonEventCuts::kPhysicsSelected;
512 if (selectTrigger) eventSelectionMask |= AliMuonEventCuts::kSelectedTrig;
515 gROOT->LoadMacro(
"$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C");
516 if (!gROOT->ProcessLineFast(
"AddTaskMultSelection()")) {
517 Error(
"CreateAnalysisTrain",
"AliCentralitySelectionTask not created!");
522 TString outputFileName = Form(
"chamberResolution_step%d.root", iStep);
523 AliAnalysisManager::SetCommonFileName(outputFileName.Data());
525 if (!muonResolution) {
526 Error(
"CreateAnalysisTrain",
"AliAnalysisTaskMuonResolution not created!");
531 muonResolution->SetDefaultStorage(
"local:///cvmfs/alice-ocdb.cern.ch/calibration/data/2016/OCDB");
532 if (mode !=
kProof) muonResolution->ShowProgressBar();
533 muonResolution->PrintClusterRes(kTRUE, kTRUE);
534 muonResolution->SetStartingResolution(clusterResNB, clusterResB);
535 muonResolution->RemoveMonoCathodClusters(kTRUE, kFALSE);
544 muonResolution->SetHalfChShift(halfChShiftNB, halfChShiftB);
545 muonResolution->ShiftHalfCh();
546 muonResolution->PrintHalfChShift();
549 muonResolution->SetDEShift(deShiftNB, deShiftB);
550 muonResolution->ShiftDE();
551 muonResolution->PrintDEShift();
554 if (eventSelectionMask != 0) {
555 AliMuonEventCuts eventCuts(
"muEventCuts",
"muEventCuts");
556 eventCuts.SetFilterMask(eventSelectionMask);
557 if (selectPhysics) eventCuts.SetPhysicsSelectionMask(AliVEvent::kAny);
559 if (selectTrigger) eventCuts.SetTrigClassPatterns(eventCuts.GetDefaultTrigClassPatterns());
560 muonResolution->SetMuonEventCuts(eventCuts);
563 UInt_t trackSelectionMask = 0;
564 if (matchTrig) trackSelectionMask |= AliMuonTrackCuts::kMuMatchLpt;
565 if (applyAccCut) trackSelectionMask |= AliMuonTrackCuts::kMuEta | AliMuonTrackCuts::kMuThetaAbs;
566 if (applyPDCACut) trackSelectionMask |= AliMuonTrackCuts::kMuPdca;
567 if (trackSelectionMask != 0) {
568 AliMuonTrackCuts trackCuts(
"muTrackCuts",
"muTrackCuts");
569 trackCuts.SetAllowDefaultParams();
570 if (isMC) trackCuts.SetIsMC();
571 trackCuts.SetFilterMask(trackSelectionMask);
572 muonResolution->SetMuonTrackCuts(trackCuts);
575 return muonResolution;
584 TFile* outFile = TFile::Open(Form(
"chamberResolution_step%d.root", iStep),
"READ");
586 if (!outFile || !outFile->IsOpen()) {
587 Error(
"GetChamberResolution",
"output file does not exist!");
592 TGraphErrors* gCombinedResidualXPerChSigma = (summary) ? static_cast<TGraphErrors*>(summary->FindObject(
"gCombinedResidualXPerChSigma")) : 0x0;
593 TGraphErrors* gCombinedResidualYPerChSigma = (summary) ? static_cast<TGraphErrors*>(summary->FindObject(
"gCombinedResidualYPerChSigma")) : 0x0;
595 if (!gCombinedResidualXPerChSigma || !gCombinedResidualYPerChSigma) {
596 Error(
"GetChamberResolution",
"resolution graphs do not exist!");
601 for (
Int_t i = 0; i < 10; i++) {
602 gCombinedResidualXPerChSigma->GetPoint(i, dummy, clusterResNB[i]);
603 gCombinedResidualYPerChSigma->GetPoint(i, dummy, clusterResB[i]);
604 clusterResNBErr[i] = gCombinedResidualXPerChSigma->GetErrorY(i);
605 clusterResBErr[i] = gCombinedResidualYPerChSigma->GetErrorY(i);
619 TFile* outFile = TFile::Open(Form(
"chamberResolution_step%d.root", iStep),
"READ");
621 if (!outFile || !outFile->IsOpen()) {
622 Error(
"AddHalfChShift",
"output file does not exist!");
627 TGraphErrors* gResidualXPerHalfChMean = (summary) ? static_cast<TGraphErrors*>(summary->FindObject(
"gResidualXPerHalfChMean_ClusterIn")) : 0x0;
628 TGraphErrors* gResidualYPerHalfChMean = (summary) ? static_cast<TGraphErrors*>(summary->FindObject(
"gResidualYPerHalfChMean_ClusterIn")) : 0x0;
630 if (!gResidualXPerHalfChMean || !gResidualYPerHalfChMean) {
631 Error(
"AddHalfChShift",
"half-chamber shift graphs do not exist!");
636 for (
Int_t i = 0; i < 20; i++) {
637 gResidualXPerHalfChMean->GetPoint(i, dummy, dx);
638 halfChShiftNB[i] += dx;
639 halfChShiftNBErr[i] = gResidualXPerHalfChMean->GetErrorY(i);
640 gResidualYPerHalfChMean->GetPoint(i, dummy, dy);
641 halfChShiftB[i] += dy;
642 halfChShiftBErr[i] = gResidualYPerHalfChMean->GetErrorY(i);
656 TFile* outFile = TFile::Open(Form(
"chamberResolution_step%d.root", iStep),
"READ");
658 if (!outFile || !outFile->IsOpen()) {
659 Error(
"AddDEShift",
"output file does not exist!");
664 TGraphErrors* gResidualXPerDEMean = (summary) ? static_cast<TGraphErrors*>(summary->FindObject(
"gResidualXPerDEMean_ClusterIn")) : 0x0;
665 TGraphErrors* gResidualYPerDEMean = (summary) ? static_cast<TGraphErrors*>(summary->FindObject(
"gResidualYPerDEMean_ClusterIn")) : 0x0;
667 if (!gResidualXPerDEMean || !gResidualYPerDEMean) {
668 Error(
"AddDEShift",
"DE shift graphs do not exist!");
673 nDE = gResidualXPerDEMean->GetN();
675 gResidualXPerDEMean->GetPoint(i, dummy, dx);
677 gResidualYPerDEMean->GetPoint(i, dummy, dy);
692 if ( ! AliMpDDLStore::Instance(
false) )
694 Warning(
"AddMCHViews",
"mapping was not loaded. Loading it from $ALICE_ROOT/OCDB");
695 if (smode ==
"saf3") AliCDBManager::Instance()->SetDefaultStorage(
"raw://");
696 else AliCDBManager::Instance()->SetDefaultStorage(
"local://$ALICE_ROOT/OCDB");
697 AliCDBManager::Instance()->SetRun(999999999);
704 Error(
"AddMCHViews",
"resolution graphs do not exist!");
709 g =
static_cast<TGraphErrors*
>(summary->FindObject(
"gCombinedResidualXPerDESigma"));
717 g =
static_cast<TGraphErrors*
>(summary->FindObject(
"gCombinedResidualYPerDESigma"));
725 g =
static_cast<TGraphErrors*
>(summary->FindObject(
"gResidualXPerDEMean_ClusterOut"));
733 g =
static_cast<TGraphErrors*
>(summary->FindObject(
"gResidualYPerDEMean_ClusterOut"));
747 AliMUON2DMap deValues(kFALSE);
749 for (
Int_t i = 0 ; i < g.GetN(); ++i )
751 double y = g.GetY()[i];
752 double ey = g.GetEY()[i];
754 sscanf(g.GetXaxis()->GetBinLabel(i+1),
"%d",&detElemId);
756 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
758 AliMUONVCalibParam* param =
new AliMUONCalibParamND(5, 1, detElemId, 0);
762 Double_t sumw2 = (sumn-1)*ey*ey+sumw*sumw/sumn;
764 param->SetValueAsDouble(0,0,sumw);
765 param->SetValueAsDouble(0,1,sumw2);
766 param->SetValueAsDouble(0,2,sumn);
767 param->SetValueAsDouble(0,3,de->NofChannels());
768 param->SetValueAsDouble(0,4,1);
773 AliMUONTrackerData* data =
new AliMUONTrackerData(name,name,deValues,1);
774 data->SetDimensionName(0,name);
782 if (smode ==
"local") {
785 else if ( input.EndsWith(
".root") )
return kLocal;
786 }
else if (smode ==
"caf" || smode ==
"saf" || smode ==
"saf3")
return kProof;
794 if (!TGrid::Connect(
"alien://"))
return NULL;
796 TGridCollection* coll = TAlienCollection::Open(xmlfile);
798 Error(
"CreateChainFromCollection",
"Cannot create the AliEn collection");
802 TGridResult* tagResult = coll->GetGridResult(
"",kFALSE,kFALSE);
803 AliTagAnalysis *tagAna =
new AliTagAnalysis(
"ESD");
804 tagAna->ChainGridTags(tagResult);
806 AliRunTagCuts *runCuts =
new AliRunTagCuts();
807 AliLHCTagCuts *lhcCuts =
new AliLHCTagCuts();
808 AliDetectorTagCuts *detCuts =
new AliDetectorTagCuts();
809 AliEventTagCuts *evCuts =
new AliEventTagCuts();
812 if (!
gSystem->AccessPathName(
"ConfigureCuts.C"))
813 gROOT->ProcessLine(Form(
".x ConfigureCuts.C((AliRunTagCuts*)%p, (AliLHCTagCuts*)%p, (AliDetectorTagCuts*)%p,"
814 " (AliEventTagCuts*)%p)", runCuts, lhcCuts, detCuts, evCuts));
816 TChain *chain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evCuts);
817 if (!chain || !chain->GetNtrees())
return NULL;
827 chain->Add(rootfile);
828 if (!chain->GetNtrees())
return NULL;
838 ifstream inFile(esdList);
840 if (inFile.is_open()) {
841 while (! inFile.eof() ) {
842 inFileName.ReadLine(inFile,kFALSE);
843 if(!inFileName.EndsWith(
".root"))
continue;
844 chain->Add(inFileName.Data());
848 if (!chain->GetNtrees())
return NULL;
856 printf(
"*******************************\n");
857 printf(
"*** Getting the Chain ***\n");
858 printf(
"*******************************\n");
Bool_t AddDEShift(Int_t iStep, Double_t deShiftNB[200], Double_t deShiftB[200])
Int_t GetMode(TString smode, TString input)
TChain * CreateChain(Int_t mode, TString input)
Bool_t Resume(Int_t &firstStep, Double_t clusterResNB[10], Double_t clusterResB[10], Double_t clusterResNBErr[10], Double_t clusterResBErr[10], Bool_t shiftHalfCh, Double_t halfChShiftNB[20], Double_t halfChShiftB[20], Double_t halfChShiftNBErr[20], Double_t halfChShiftBErr[20], Bool_t shiftDE, Double_t deShiftNB[200], Double_t deShiftB[200], TGraphErrors *clusterResXVsStep[10], TGraphErrors *clusterResYVsStep[10], TGraphErrors *halfChShiftXVsStep[20], TGraphErrors *halfChShiftYVsStep[20])
TList * list
TDirectory file where lists per trigger are stored in train ouput.
void LoadAlirootOnProof(TString &aaf, TString rootVersion, TString aliphysicsVersion, Int_t iStep)
TChain * CreateChainFromESDList(const char *esdList)
TObjArray * GetCanvases()
return the list of summary canvases
Bool_t GetChamberResolution(Int_t iStep, Double_t clusterResNB[10], Double_t clusterResB[10], Double_t clusterResNBErr[10], Double_t clusterResBErr[10])
TChain * CreateChainFromCollection(const char *xmlfile)
AliAnalysisTaskMuonResolution * AddTaskMuonResolution(Double_t minMomentum=0., Double_t minPt=0., Bool_t correctForSystematics=kTRUE, Int_t extrapMode=1)
void GetHalfChShift(Double_t valNB[20], Double_t valB[20]) const
void MuonResolution(TString smode, TString inputFileName, TString rootVersion, TString aliphysicsVersion, Int_t nSteps, Bool_t selectPhysics, Bool_t selectTrigger, Bool_t matchTrig, Bool_t applyAccCut, Bool_t applyPDCACut, Double_t minMomentum, Double_t minPt, Bool_t isMC, Bool_t correctForSystematics, Int_t extrapMode, Bool_t shiftHalfCh, Bool_t shiftDE, Int_t nevents)
void AddMCHViews(TString smode, TFile *file)
void GetStartingResolution(Double_t valNB[10], Double_t valB[10]) const
TChain * CreateChainFromFile(const char *rootfile)
Muon spectrometer resolution.
TFile * file
TList with histograms for a given trigger.
Bool_t AddHalfChShift(Int_t iStep, Double_t halfChShiftNB[20], Double_t halfChShiftB[20], Double_t halfChShiftNBErr[20], Double_t halfChShiftBErr[20])
void GetDEShift(Double_t valNB[200], Double_t valB[200]) const
AliAnalysisTaskMuonResolution * CreateAnalysisTrain(Int_t mode, Int_t iStep, Bool_t selectPhysics, Bool_t selectTrigger, Bool_t matchTrig, Bool_t applyAccCut, Bool_t applyPDCACut, Double_t minMomentum, Double_t minPt, Bool_t isMC, Bool_t correctForSystematics, Int_t extrapMode, Double_t clusterResNB[10], Double_t clusterResB[10], Bool_t shiftHalfCh, Double_t halfChShiftNB[20], Double_t halfChShiftB[20], Bool_t shiftDE, Double_t deShiftNB[200], Double_t deShiftB[200])
AliMUONTrackerData * ConvertGraph(TGraphErrors &g, const char *name)