]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/TenderSupplies/AliVtxTenderSupply.cxx
First version of the TenderSupplies for TPC/TOF/TRD
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AliVtxTenderSupply.cxx
CommitLineData
e75408ba 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17///////////////////////////////////////////////////////////////////////////////
18// //
19// Redo primary vertex on the fly, using the diamond constraint //
20// //
21///////////////////////////////////////////////////////////////////////////////
22
23
24#include <AliESDEvent.h>
25#include <AliESDInputHandler.h>
26#include <AliVertexerTracks.h>
27#include <AliTender.h>
28#include <AliCDBId.h>
29#include <AliCDBManager.h>
30#include <AliCDBEntry.h>
31
32#include "AliVtxTenderSupply.h"
33
34AliVtxTenderSupply::AliVtxTenderSupply() :
35 AliTenderSupply(),
36 fDiamond(0x0)
37{
38 //
39 // default ctor
40 //
41}
42
43//_____________________________________________________
44AliVtxTenderSupply::AliVtxTenderSupply(const char *name, const AliTender *tender) :
45 AliTenderSupply(name,tender),
46 fDiamond(0x0)
47{
48 //
49 // named ctor
50 //
51}
52
53//_____________________________________________________
54void AliVtxTenderSupply::ProcessEvent()
55{
56 //
57 // Recalculate the Vertex with constraint
58 //
59
60 AliESDEvent *event=fTender->GetEvent();
61 if (!event) return;
62
63 //
64
65 if (fTender->RunChanged()){
66 fDiamond=0x0;
67 AliCDBEntry *meanVertex=fTender->GetCDBManager()->Get("GRP/Calib/MeanVertex",fTender->GetRun());
68 if (!meanVertex) {
69 AliError("No new MeanVertex entry found");
70 return;
71 } else {
72 fDiamond=(AliESDVertex*)meanVertex->GetObject();
73 }
74 //printf("\nRun %d, sigmaX %f, sigmaY %f\n",fTender->GetRun(),fDiamond->GetXRes(),fDiamond->GetYRes());
75 }
76
77 if (!fDiamond) return;
78
79 // Redo the primary with the constraint ONLY if the updated mean vertex was found in the OCDB
80 if ( (fDiamond->GetXRes())<2){
81 AliVertexerTracks vertexer(event->GetMagneticField());
82 vertexer.SetITSMode();
83 vertexer.SetMinClusters(4);
84 vertexer.SetVtxStart(fDiamond);
85 AliESDVertex *pvertex = vertexer.FindPrimaryVertex(event);
86 event->SetPrimaryVertexTracks(pvertex);
87 }
88}