]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TENDER/TenderSupplies/AliVtxTenderSupply.cxx
Split: Tender*, EventMixing out of ANALYSIS
[u/mrichter/AliRoot.git] / TENDER / 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>
158b9855 31#include <AliESDUtils.h>
e75408ba 32
33#include "AliVtxTenderSupply.h"
34
e26aa0bb 35ClassImp(AliVtxTenderSupply)
36
e75408ba 37AliVtxTenderSupply::AliVtxTenderSupply() :
38 AliTenderSupply(),
158b9855 39 fDiamond(0x0),
40 fRefitAlgo(-1)
e75408ba 41{
42 //
43 // default ctor
44 //
45}
46
47//_____________________________________________________
48AliVtxTenderSupply::AliVtxTenderSupply(const char *name, const AliTender *tender) :
49 AliTenderSupply(name,tender),
158b9855 50 fDiamond(0x0),
51 fRefitAlgo(-1)
e75408ba 52{
53 //
54 // named ctor
55 //
56}
57
58//_____________________________________________________
59void AliVtxTenderSupply::ProcessEvent()
60{
61 //
62 // Recalculate the Vertex with constraint
63 //
64
65 AliESDEvent *event=fTender->GetEvent();
66 if (!event) return;
67
158b9855 68 //
69 if (fRefitAlgo >=0 ) { // refit with user supplied algo and using the diamond stored in ESD
70 AliESDUtils::RefitESDVertexTracks(event, fRefitAlgo);
71 return;
72 }
e75408ba 73 //
74
75 if (fTender->RunChanged()){
76 fDiamond=0x0;
77 AliCDBEntry *meanVertex=fTender->GetCDBManager()->Get("GRP/Calib/MeanVertex",fTender->GetRun());
78 if (!meanVertex) {
79 AliError("No new MeanVertex entry found");
80 return;
81 } else {
82 fDiamond=(AliESDVertex*)meanVertex->GetObject();
83 }
84 //printf("\nRun %d, sigmaX %f, sigmaY %f\n",fTender->GetRun(),fDiamond->GetXRes(),fDiamond->GetYRes());
85 }
86
87 if (!fDiamond) return;
88
89 // Redo the primary with the constraint ONLY if the updated mean vertex was found in the OCDB
90 if ( (fDiamond->GetXRes())<2){
91 AliVertexerTracks vertexer(event->GetMagneticField());
92 vertexer.SetITSMode();
f112fd2c 93 vertexer.SetMinClusters(3);
e75408ba 94 vertexer.SetVtxStart(fDiamond);
95 AliESDVertex *pvertex = vertexer.FindPrimaryVertex(event);
96 event->SetPrimaryVertexTracks(pvertex);
04ca0a38 97 // write the diamond parameters
98 event->SetDiamond(fDiamond);
158b9855 99 delete pvertex;
e75408ba 100 }
101}