1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // Redo primary vertex on the fly, using the diamond constraint //
21 ///////////////////////////////////////////////////////////////////////////////
24 #include <AliESDEvent.h>
25 #include <AliESDInputHandler.h>
26 #include <AliVertexerTracks.h>
27 #include <AliTender.h>
29 #include <AliCDBManager.h>
30 #include <AliCDBEntry.h>
31 #include <AliESDUtils.h>
33 #include "AliVtxTenderSupply.h"
35 ClassImp(AliVtxTenderSupply)
37 AliVtxTenderSupply::AliVtxTenderSupply() :
47 //_____________________________________________________
48 AliVtxTenderSupply::AliVtxTenderSupply(const char *name, const AliTender *tender) :
49 AliTenderSupply(name,tender),
58 //_____________________________________________________
59 void AliVtxTenderSupply::ProcessEvent()
62 // Recalculate the Vertex with constraint
65 AliESDEvent *event=fTender->GetEvent();
69 if (fRefitAlgo >=0 ) { // refit with user supplied algo and using the diamond stored in ESD
70 AliESDUtils::RefitESDVertexTracks(event, fRefitAlgo);
75 if (fTender->RunChanged()){
77 AliCDBEntry *meanVertex=fTender->GetCDBManager()->Get("GRP/Calib/MeanVertex",fTender->GetRun());
79 AliError("No new MeanVertex entry found");
82 fDiamond=(AliESDVertex*)meanVertex->GetObject();
84 //printf("\nRun %d, sigmaX %f, sigmaY %f\n",fTender->GetRun(),fDiamond->GetXRes(),fDiamond->GetYRes());
87 if (!fDiamond) return;
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();
93 vertexer.SetMinClusters(3);
94 vertexer.SetVtxStart(fDiamond);
95 AliESDVertex *pvertex = vertexer.FindPrimaryVertex(event);
96 event->SetPrimaryVertexTracks(pvertex);
97 // write the diamond parameters
98 event->SetDiamond(fDiamond);