]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/TenderSupplies/AliT0TenderSupply.cxx
add muons to the path
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AliT0TenderSupply.cxx
CommitLineData
e8eb8c54 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// T0 Tender supply //
19// //
20// //
21///////////////////////////////////////////////////////////////////////////
22
23#include <AliESDEvent.h>
24#include <AliESDtrack.h>
25
26#include <AliTender.h>
27#include <AliT0TenderSupply.h>
1f671b29 28#include <AliCDBManager.h>
29#include <AliCDBEntry.h>
30#include <AliT0CalibSeasonTimeShift.h>
e8eb8c54 31
32
33ClassImp(AliT0TenderSupply)
34
35//________________________________________________________________________
36AliT0TenderSupply::AliT0TenderSupply():
37 AliTenderSupply(),
38 fCorrectMeanTime(kFALSE),
39 fCorrectStartTimeOnAmplSatur(kFALSE),
1f671b29 40 fAmplitudeThreshold(100),
41 fPass4LHC11aCorrection(kFALSE)
e8eb8c54 42{
43 //
44 // default constructor
45 //
1f671b29 46 for(int i=0; i<4; i++) fTimeOffset[i]=0;
e8eb8c54 47}
48
49//________________________________________________________________________
50AliT0TenderSupply::AliT0TenderSupply(const char *name, const AliTender *tender):
51 AliTenderSupply(name,tender),
52 fCorrectMeanTime(kFALSE),
53 fCorrectStartTimeOnAmplSatur(kFALSE),
1f671b29 54 fAmplitudeThreshold(100),
55 fPass4LHC11aCorrection(kFALSE)
e8eb8c54 56{
57 //
58 // constructor
59 //
60 for(int i=0; i<3; i++) fTimeOffset[i]=0;
61}
62
63//________________________________________________________________________
64AliT0TenderSupply::~AliT0TenderSupply(){
65 //
66 // destructor
67 //
68
69}
70
71//________________________________________________________________________
72void AliT0TenderSupply::Init(){
73 //
74 // Init
75 //
76 Int_t run = fTender->GetRun();
77 if (run == 0) return; // to skip first init, when we don't have yet a run number
78
79 fCorrectMeanTime = kFALSE; //reset
1f671b29 80 for(int i=0; i<4; i++) fTimeOffset[i]=0;
81
82
83 fCorrectStartTimeOnAmplSatur = kFALSE;
84 fAmplitudeThreshold = 100; //in mips
85
86 if(167693<= run && run<=170593){ // LHC11h
87 fCorrectStartTimeOnAmplSatur = kTRUE;
88 fAmplitudeThreshold = 50; //in mips
89 }
e8eb8c54 90
e8eb8c54 91}
92
93//________________________________________________________________________
94void AliT0TenderSupply::ProcessEvent(){
95 //
96 // loop over all online T0 candidates and flag
97 // selected daughter tracks using the status bis of the TObject
98 //
99
100 AliESDEvent *event=fTender->GetEvent();
101 if (!event) return;
102
103 //Do something when the run number changed, like loading OCDB entries etc.
104 if(fTender->RunChanged()){
105 Init();
106 }
107
1f671b29 108 if(fPass4LHC11aCorrection) {
109 const Double32_t* mean = event->GetT0TOF();
110 event->SetT0TOF(0, (mean[1]+mean[2])/2.);
e8eb8c54 111
1f671b29 112 }
e8eb8c54 113 if(fCorrectStartTimeOnAmplSatur){
114 //correct A side ORA on amplitude saturation
115 const Double32_t* time = event->GetT0time();
116 const Double32_t* amplitude = event->GetT0amplitude();
117
118 Int_t idxOfFirstPmtA = -1;
119 Double32_t timeOrA = 99999;
120 for(int ipmt=12; ipmt<24; ipmt++){ //loop over A side
121 if( amplitude[ipmt] < fAmplitudeThreshold){
122 if( time[ipmt] > -200 && time[ipmt]!=0 && time[ipmt] < timeOrA ){
123 timeOrA = time[ipmt];
124 idxOfFirstPmtA = ipmt;
125 }
126 }
127 }
128
129 if(idxOfFirstPmtA>-1){ //a hit in aside with less than 40 mips
130 const Double32_t* mean = event->GetT0TOF();
131 Double32_t timeOrC = mean[2];
132 Double32_t timeOrAplusOrC = (timeOrA+timeOrC)/2;
133
134 event->SetT0TOF(0, timeOrAplusOrC);
135 event->SetT0TOF(1, timeOrA);
136 }
137 }
138
139 //...........................................
1f671b29 140 Float_t *t0means=0x0;
141 if(fCorrectMeanTime){
142 AliCDBManager* ocdbMan = AliCDBManager::Instance();
143 ocdbMan->SetRun(fTender->GetRun());
144 AliCDBEntry *entry = ocdbMan->Get("T0/Calib/TimeAdjust/");
145 if(entry) {
146 AliT0CalibSeasonTimeShift *clb = (AliT0CalibSeasonTimeShift*) entry->GetObject();
147 t0means= clb->GetT0Means();
148 } else {
149 for (Int_t i=0;i<4;i++) t0means[i]=0;
150 AliWarning("T0Tender no T0 entry found T0shift set to 0");
151 }
152 } else {
153 for (Int_t i=0;i<4;i++) t0means=0;
e8eb8c54 154 }
1f671b29 155 // correct mean time offsets
156 const Double32_t* mean = event->GetT0TOF();
157 for(int it0=0; it0<3; it0++){
158 if(-2000 < mean[it0]){
159 event->SetT0TOF(it0, mean[it0] - t0means[it0]);
160 }
161 }
162}
163
e8eb8c54 164