/// //
///////////////////////////////////////////////////////////////////////////////
+#include <TH1F.h>
+#include <TF1.h>
+#include <TParameter.h>
+
#include "AliRunLoader.h"
#include "AliRawReader.h"
+#include "AliGRPObject.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
#include "AliVZEROReconstructor.h"
#include "AliVZERORawStream.h"
+#include "AliVZEROConst.h"
#include "AliESDEvent.h"
#include "AliVZEROTriggerMask.h"
+#include "AliESDfriend.h"
+#include "AliESDVZEROfriend.h"
+#include "AliVZEROdigit.h"
+#include "AliVZEROCalibData.h"
+#include "AliRunInfo.h"
+#include "AliCTPTimeParams.h"
+#include "AliLHCClockPhase.h"
ClassImp(AliVZEROReconstructor)
//_____________________________________________________________________________
AliVZEROReconstructor:: AliVZEROReconstructor(): AliReconstructor(),
- fESDVZERO(0x0),
- fESD(0x0),
- fCalibData(GetCalibData())
+ fESDVZERO(0x0),
+ fESD(0x0),
+ fESDVZEROfriend(0x0),
+ fCalibData(NULL),
+ fTriggerData(NULL),
+ fTimeSlewing(NULL),
+ fSaturationCorr(NULL),
+ fEqFactors(NULL),
+ fCollisionMode(0),
+ fBeamEnergy(0.),
+ fDigitsArray(0)
{
// Default constructor
// Get calibration data
- // fCalibData = GetCalibData();
+ fCalibData = GetCalibData();
+
+ AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
+ if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
+ AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
+ Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
+
+ AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
+ if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
+ AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
+ l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
+
+ AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
+ if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
+ TH1F *delays = (TH1F*)entry2->GetObject();
+
+ AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeSlewing");
+ if (!entry3) AliFatal("VZERO time slewing function is not found in OCDB !");
+ fTimeSlewing = (TF1*)entry3->GetObject();
+
+ AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase");
+ if (!entry4) AliFatal("LHC clock-phase shift is not found in OCDB !");
+ AliLHCClockPhase *phase = (AliLHCClockPhase*)entry4->GetObject();
+
+ for(Int_t i = 0 ; i < 64; ++i) {
+ Int_t board = AliVZEROCalibData::GetBoardNumber(i);
+ fTimeOffset[i] = (((Float_t)fCalibData->GetRollOver(board)-
+ (Float_t)fCalibData->GetTriggerCountOffset(board))*25.0+
+ fCalibData->GetTimeOffset(i)-
+ l1Delay-
+ phase->GetMeanPhase()+
+ delays->GetBinContent(i+1)+
+ kV0Offset);
+ }
+
+ AliCDBEntry *entry5 = AliCDBManager::Instance()->Get("VZERO/Calib/Saturation");
+ if (!entry5) AliFatal("Saturation entry is not found in OCDB !");
+ fSaturationCorr = (TObjArray*)entry5->GetObject();
+ AliCDBEntry *entry6 = AliCDBManager::Instance()->Get("VZERO/Trigger/Data");
+ if (!entry6) AliFatal("VZERO trigger config data is not found in OCDB !");
+ fTriggerData = (AliVZEROTriggerData*)entry6->GetObject();
+
+ AliCDBEntry *entry7 = AliCDBManager::Instance()->Get("VZERO/Calib/EqualizationFactors");
+ if (!entry7) AliFatal("VZERO equalization factors are not found in OCDB !");
+ fEqFactors = (TH1F*)entry7->GetObject();
}
{
// destructor
- delete fESDVZERO;
+ if(fESDVZERO)
+ delete fESDVZERO;
+ if(fESDVZEROfriend)
+ delete fESDVZEROfriend;
+ if(fDigitsArray)
+ delete fDigitsArray;
}
//_____________________________________________________________________________
// initializer
fESDVZERO = new AliESDVZERO;
+ fESDVZEROfriend = new AliESDVZEROfriend;
+
+ GetCollisionMode(); // fCollisionMode =1 for Pb-Pb simulated data
}
//______________________________________________________________________
void AliVZEROReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
{
-// converts RAW to digits - pedestal is subtracted
+// converts RAW to digits
if (!digitsTree) {
AliError("No digits tree!");
return;
}
- TClonesArray* digitsArray = new TClonesArray("AliVZEROdigit");
- digitsTree->Branch("VZERODigit", &digitsArray);
+ if (!fDigitsArray)
+ fDigitsArray = new TClonesArray("AliVZEROdigit", 64);
+ digitsTree->Branch("VZERODigit", &fDigitsArray);
+
+ fESDVZEROfriend->Reset();
rawReader->Reset();
AliVZERORawStream rawStream(rawReader);
- if (rawStream.Next()) {
- Int_t ADC_max[64], adc[64], time[64];
- for(Int_t i=0; i<64; i++) {
- // Search for the maximum charge in the train of 21 LHC clocks
- // regardless of the integrator which has been operated:
- ADC_max[i] = 0;
- for(Int_t iClock=0; iClock<21; iClock++){
- if((Int_t)rawStream.GetPedestal(i,iClock) > ADC_max[i])
- {ADC_max[i]=(Int_t)rawStream.GetPedestal(i,iClock);}
- }
- // Convert i (FEE channel numbering) to j (aliroot channel numbering)
- Int_t j = rawStream.GetOfflineChannel(i);
- adc[j] = ADC_max[i];
- time[j] = rawStream.GetTime(i);
- }
- // Channels(aliroot numbering) will be ordered in the tree
- for(Int_t iChannel = 0; iChannel < 64; iChannel++) {
- new ((*digitsArray)[digitsArray->GetEntriesFast()])
- AliVZEROdigit(iChannel,adc[iChannel],time[iChannel]);
- }
+ if (rawStream.Next()) {
+
+ Int_t aBBflagsV0A = 0;
+ Int_t aBBflagsV0C = 0;
+ Int_t aBGflagsV0A = 0;
+ Int_t aBGflagsV0C = 0;
+
+ for(Int_t iChannel=0; iChannel < 64; ++iChannel) {
+ Int_t offlineCh = rawStream.GetOfflineChannel(iChannel);
+ // ADC charge samples
+ Short_t chargeADC[AliVZEROdigit::kNClocks];
+ for(Int_t iClock=0; iClock < AliVZEROdigit::kNClocks; ++iClock) {
+ chargeADC[iClock] = rawStream.GetPedestal(iChannel,iClock);
+ }
+ // Integrator flag
+ Bool_t integrator = rawStream.GetIntegratorFlag(iChannel,AliVZEROdigit::kNClocks/2);
+ // Beam-beam and beam-gas flags
+ if(offlineCh<32) {
+ if (rawStream.GetBBFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBBflagsV0C |= (1 << offlineCh);
+ if (rawStream.GetBGFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBGflagsV0C |= (1 << offlineCh);
+ } else {
+ if (rawStream.GetBBFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBBflagsV0A |= (1 << (offlineCh-32));
+ if (rawStream.GetBGFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBGflagsV0A |= (1 << (offlineCh-32));
+ }
+ // HPTDC data (leading time and width)
+ Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh);
+ Float_t time = rawStream.GetTime(iChannel)*fCalibData->GetTimeResolution(board);
+ Float_t width = rawStream.GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
+ // Add a digit
+ if(!fCalibData->IsChannelDead(iChannel)){
+ new ((*fDigitsArray)[fDigitsArray->GetEntriesFast()])
+ AliVZEROdigit(offlineCh, time,
+ width,integrator,
+ chargeADC);
+ }
+
+ // Filling the part of esd friend object that is available only for raw data
+ fESDVZEROfriend->SetBBScalers(offlineCh,rawStream.GetBBScalers(iChannel));
+ fESDVZEROfriend->SetBGScalers(offlineCh,rawStream.GetBGScalers(iChannel));
+ for (Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++) {
+ fESDVZEROfriend->SetChargeMB(offlineCh,iBunch,rawStream.GetChargeMB(iChannel,iBunch));
+ fESDVZEROfriend->SetIntMBFlag(offlineCh,iBunch,rawStream.GetIntMBFlag(iChannel,iBunch));
+ fESDVZEROfriend->SetBBMBFlag(offlineCh,iBunch,rawStream.GetBBMBFlag(iChannel,iBunch));
+ fESDVZEROfriend->SetBGMBFlag(offlineCh,iBunch,rawStream.GetBGMBFlag(iChannel,iBunch));
+ }
+ for (Int_t iEv = 0; iEv < AliESDVZEROfriend::kNEvOfInt; iEv++) {
+ fESDVZEROfriend->SetBBFlag(offlineCh,iEv,rawStream.GetBBFlag(iChannel,iEv));
+ fESDVZEROfriend->SetBGFlag(offlineCh,iEv,rawStream.GetBGFlag(iChannel,iEv));
+ }
+ }
+
+ // Filling the global part of esd friend object that is available only for raw data
+ rawStream.FillTriggerBits(fTriggerData);
+ fESDVZEROfriend->SetTriggerInputs(rawStream.GetTriggerInputs());
+ fESDVZEROfriend->SetTriggerInputsMask(rawStream.GetTriggerInputsMask());
+
+ for(Int_t iScaler = 0; iScaler < AliESDVZEROfriend::kNScalers; iScaler++)
+ fESDVZEROfriend->SetTriggerScalers(iScaler,rawStream.GetTriggerScalers(iScaler));
+
+ for(Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++)
+ fESDVZEROfriend->SetBunchNumbersMB(iBunch,rawStream.GetBunchNumbersMB(iBunch));
+
+ // Store the BB and BG flags in the digits tree (user info)
+ digitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0A",aBBflagsV0A));
+ digitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0C",aBBflagsV0C));
+ digitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0A",aBGflagsV0A));
+ digitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0C",aBGflagsV0C));
+
+ UShort_t chargeA,chargeC;
+ rawStream.CalculateChargeForCentrTriggers(fTriggerData,chargeA,chargeC);
+ digitsTree->GetUserInfo()->Add(new TParameter<int>("ChargeA",(Int_t)chargeA));
+ digitsTree->GetUserInfo()->Add(new TParameter<int>("ChargeC",(Int_t)chargeC));
+ digitsTree->GetUserInfo()->Add(new TParameter<int>("TriggerInputs",(Int_t)rawStream.GetTriggerInputs()));
+
+ digitsTree->Fill();
}
- digitsTree->Fill();
-}
+ fDigitsArray->Clear();
+}
//______________________________________________________________________
void AliVZEROReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,
AliESDEvent* esd) const
{
-// fills multiplicities to the ESD
-
+// fills multiplicities to the ESD - pedestal is now subtracted
+
if (!digitsTree) {
- AliError("No digits tree!");
- return;
+ AliError("No digits tree!");
+ return;
}
- TClonesArray* digitsArray = NULL;
TBranch* digitBranch = digitsTree->GetBranch("VZERODigit");
- digitBranch->SetAddress(&digitsArray);
+ digitBranch->SetAddress(&fDigitsArray);
- Short_t Multiplicity[64];
Float_t mult[64];
- Short_t adc[64];
- Short_t time[64];
+ Float_t adc[64];
+ Float_t time[64];
+ Float_t width[64];
+ Bool_t aBBflag[64];
+ Bool_t aBGflag[64];
+
for (Int_t i=0; i<64; i++){
- adc[i] = 0;
- mult[i]= 0.0;
+ adc[i] = 0.0;
+ mult[i] = 0.0;
+ time[i] = kInvalidTime;
+ width[i] = 0.0;
+ aBBflag[i] = kFALSE;
+ aBGflag[i] = kFALSE;
}
- // loop over VZERO entries to get multiplicity
+ Int_t aBBflagsV0A = 0;
+ Int_t aBBflagsV0C = 0;
+ Int_t aBGflagsV0A = 0;
+ Int_t aBGflagsV0C = 0;
+
+ if (digitsTree->GetUserInfo()->FindObject("BBflagsV0A")) {
+ aBBflagsV0A = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BBflagsV0A"))->GetVal();
+ }
+ else {
+ if (esd && (esd->GetEventType() == 7))
+ AliWarning("V0A beam-beam flags not found in digits tree UserInfo!");
+ }
+
+ if (digitsTree->GetUserInfo()->FindObject("BBflagsV0C")) {
+ aBBflagsV0C = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BBflagsV0C"))->GetVal();
+ }
+ else {
+ if (esd && (esd->GetEventType() == 7))
+ AliWarning("V0C beam-beam flags not found in digits tree UserInfo!");
+ }
+
+ if (digitsTree->GetUserInfo()->FindObject("BGflagsV0A")) {
+ aBGflagsV0A = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BGflagsV0A"))->GetVal();
+ }
+ else {
+ if (esd && (esd->GetEventType() == 7))
+ AliWarning("V0A beam-gas flags not found in digits tree UserInfo!");
+ }
+
+ if (digitsTree->GetUserInfo()->FindObject("BGflagsV0C")) {
+ aBGflagsV0C = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BGflagsV0C"))->GetVal();
+ }
+ else {
+ if (esd && (esd->GetEventType() == 7))
+ AliWarning("V0C beam-gas flags not found in digits tree UserInfo!");
+ }
+
+ // Beam-beam and beam-gas flags (hardware)
+ for (Int_t iChannel = 0; iChannel < 64; ++iChannel) {
+ if(iChannel < 32) {
+ aBBflag[iChannel] = (aBBflagsV0C >> iChannel) & 0x1;
+ aBGflag[iChannel] = (aBGflagsV0C >> iChannel) & 0x1;
+ }
+ else {
+ aBBflag[iChannel] = (aBBflagsV0A >> (iChannel-32)) & 0x1;
+ aBGflag[iChannel] = (aBGflagsV0A >> (iChannel-32)) & 0x1;
+ }
+ }
+
+ // Fill the trigger charges and bits
+ UShort_t chargeA = 0;
+ UShort_t chargeC = 0;
+ UShort_t triggerInputs = 0;
+ if (digitsTree->GetUserInfo()->FindObject("ChargeA")) {
+ chargeA = (UShort_t)(((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("ChargeA"))->GetVal());
+ }
+ else {
+ if (esd && (esd->GetEventType() == 7))
+ AliWarning("V0A trigger charge not found in digits tree UserInfo!");
+ }
+
+ if (digitsTree->GetUserInfo()->FindObject("ChargeC")) {
+ chargeC = (UShort_t)(((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("ChargeC"))->GetVal());
+ }
+ else {
+ if (esd && (esd->GetEventType() == 7))
+ AliWarning("V0C trigger charge not found in digits tree UserInfo!");
+ }
+
+ if (digitsTree->GetUserInfo()->FindObject("TriggerInputs")) {
+ triggerInputs = (UShort_t)(((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("TriggerInputs"))->GetVal());
+ }
+ else {
+ if (esd && (esd->GetEventType() == 7))
+ AliWarning("V0C trigger charge not found in digits tree UserInfo!");
+ }
+
+ fESDVZERO->SetTriggerChargeA(chargeA);
+ fESDVZERO->SetTriggerChargeC(chargeC);
+ fESDVZERO->SetTriggerBits(triggerInputs);
+ fESDVZERO->SetBit(AliESDVZERO::kTriggerChargeBitsFilled,kTRUE);
+
Int_t nEntries = (Int_t)digitsTree->GetEntries();
for (Int_t e=0; e<nEntries; e++) {
digitsTree->GetEvent(e);
- Int_t nDigits = digitsArray->GetEntriesFast();
+ Int_t nDigits = fDigitsArray->GetEntriesFast();
for (Int_t d=0; d<nDigits; d++) {
- AliVZEROdigit* digit = (AliVZEROdigit*)digitsArray->At(d);
- Int_t pmNumber = digit->PMNumber();
- // Pedestal retrieval and suppression:
- Int_t pedestal = int(fCalibData->GetPedestal(d));
- adc[pmNumber] = (Short_t) digit->ADC() - pedestal;
- time[pmNumber] = (Short_t) digit->Time();
- // printf("PM = %d, MIP per ADC channel = %f \n",pmNumber, GetMIP(pmNumber));
- // cut of ADC at 1MIP/2
- if (adc[pmNumber] > (int(1.0/GetMIP(pmNumber)) /2) )
- mult[pmNumber] += float(adc[pmNumber])*GetMIP(pmNumber);
+ AliVZEROdigit* digit = (AliVZEROdigit*) fDigitsArray->At(d);
+ Int_t pmNumber = digit->PMNumber();
+
+ // Pedestal retrieval and suppression
+ Bool_t integrator = digit->Integrator();
+ Float_t maxadc = 0;
+ Int_t imax = -1;
+ Float_t adcPedSub[AliVZEROdigit::kNClocks];
+ for(Int_t iClock=0; iClock < AliVZEROdigit::kNClocks; ++iClock) {
+ Short_t charge = digit->ChargeADC(iClock);
+ Bool_t iIntegrator = (iClock%2 == 0) ? integrator : !integrator;
+ Int_t k = pmNumber + 64*iIntegrator;
+ adcPedSub[iClock] = (Float_t)charge - fCalibData->GetPedestal(k);
+ if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
+ adcPedSub[iClock] = 0;
+ continue;
+ }
+ if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
+ if(adcPedSub[iClock] > maxadc) {
+ maxadc = adcPedSub[iClock];
+ imax = iClock;
+ }
+ }
+
+ if (imax != -1) {
+ Int_t start = imax - GetRecoParam()->GetNPreClocks();
+ if (start < 0) start = 0;
+ Int_t end = imax + GetRecoParam()->GetNPostClocks();
+ if (end > 20) end = 20;
+ for(Int_t iClock = start; iClock <= end; iClock++) {
+ adc[pmNumber] += adcPedSub[iClock];
+ }
+ }
+
+ // HPTDC leading time and width
+ // Correction for slewing and various time delays
+ time[pmNumber] = CorrectLeadingTime(pmNumber,digit->Time(),adc[pmNumber]);
+ width[pmNumber] = digit->Width();
+
+ if (adc[pmNumber] > 0) {
+ AliDebug(1,Form("PM = %d ADC = %f TDC %f (%f) Int %d (%d %d %d %d %d) %f %f %f %f %d %d",pmNumber, adc[pmNumber],
+ digit->Time(),time[pmNumber],
+ integrator,
+ digit->ChargeADC(8),digit->ChargeADC(9),digit->ChargeADC(10),
+ digit->ChargeADC(11),digit->ChargeADC(12),
+ fCalibData->GetPedestal(pmNumber),fCalibData->GetSigma(pmNumber),
+ fCalibData->GetPedestal(pmNumber+64),fCalibData->GetSigma(pmNumber+64),
+ aBBflag[pmNumber],aBGflag[pmNumber]));
+ };
+
+ TF1 *saturationFunc = (TF1*)fSaturationCorr->UncheckedAt(pmNumber);
+ if (!saturationFunc) AliFatal(Form("Saturation correction for channel %d is not found!",pmNumber));
+ AliDebug(1,Form("Saturation PM=%d %f %f",pmNumber,adc[pmNumber],saturationFunc->Eval(adc[pmNumber])));
+ mult[pmNumber] = saturationFunc->Eval(adc[pmNumber])*fCalibData->GetMIPperADC(pmNumber);
+
+ // Fill ESD friend object
+ for (Int_t iEv = 0; iEv < AliESDVZEROfriend::kNEvOfInt; iEv++) {
+ fESDVZEROfriend->SetPedestal(pmNumber,iEv,(Float_t)digit->ChargeADC(iEv));
+ fESDVZEROfriend->SetIntegratorFlag(pmNumber,iEv,(iEv%2 == 0) ? integrator : !integrator);
+ }
+ fESDVZEROfriend->SetTime(pmNumber,digit->Time());
+ fESDVZEROfriend->SetWidth(pmNumber,digit->Width());
+
} // end of loop over digits
} // end of loop over events in digits tree
-
- for (Int_t j=0; j<64; j++) Multiplicity[j] = short(mult[j]+0.5);
- fESDVZERO->SetMultiplicity(Multiplicity);
+
+ fESDVZERO->SetBit(AliESDVZERO::kCorrectedLeadingTime,kTRUE);
+ fESDVZERO->SetMultiplicity(mult);
fESDVZERO->SetADC(adc);
fESDVZERO->SetTime(time);
+ fESDVZERO->SetWidth(width);
+ fESDVZERO->SetBit(AliESDVZERO::kOnlineBitsFilled,kTRUE);
+ fESDVZERO->SetBBFlag(aBBflag);
+ fESDVZERO->SetBGFlag(aBGflag);
+ fESDVZERO->SetBit(AliESDVZERO::kCorrectedForSaturation,kTRUE);
+
+ // now fill the V0 decision and channel flags
+ {
+ AliVZEROTriggerMask triggerMask;
+ triggerMask.SetRecoParam(GetRecoParam());
+ triggerMask.FillMasks(fESDVZERO, fCalibData, fTimeSlewing);
+ }
- // now get the trigger mask
-
- AliVZEROTriggerMask *TriggerMask = new AliVZEROTriggerMask();
- TriggerMask->SetAdcThreshold(20.0/2.0);
- TriggerMask->SetTimeWindowWidthBBA(50);
- TriggerMask->SetTimeWindowWidthBGA(20);
- TriggerMask->SetTimeWindowWidthBBC(50);
- TriggerMask->SetTimeWindowWidthBGC(20);
- TriggerMask->FillMasks(digitsTree,digitsArray);
-
- fESDVZERO->SetBBtriggerV0A(TriggerMask->GetBBtriggerV0A());
- fESDVZERO->SetBGtriggerV0A(TriggerMask->GetBGtriggerV0A());
- fESDVZERO->SetBBtriggerV0C(TriggerMask->GetBBtriggerV0C());
- fESDVZERO->SetBGtriggerV0C(TriggerMask->GetBGtriggerV0C());
-
if (esd) {
AliDebug(1, Form("Writing VZERO data to ESD tree"));
esd->SetVZEROData(fESDVZERO);
+ const AliESDRun *esdRun = esd->GetESDRun();
+ if (esdRun) {
+ Float_t factors[64];
+ Float_t factorSum = 0;
+ for(Int_t i = 0; i < 64; ++i) {
+ factors[i] = fEqFactors->GetBinContent(i+1)*fCalibData->GetMIPperADC(i);
+ factorSum += factors[i];
+ }
+ for(Int_t i = 0; i < 64; ++i) factors[i] *= (64./factorSum);
+
+ esd->SetVZEROEqFactors(factors);
+ }
+ else
+ AliError("AliESDRun object is not available! Cannot write the equalization factors!");
+ }
+
+ if (esd) {
+ AliESDfriend *fr = (AliESDfriend*)esd->FindListObject("AliESDfriend");
+ if (fr) {
+ AliDebug(1, Form("Writing VZERO friend data to ESD tree"));
+ fr->SetVZEROfriend(fESDVZEROfriend);
+ }
}
+
+ fDigitsArray->Clear();
}
//_____________________________________________________________________________
return storage;
}
+//____________________________________________________________________________
+void AliVZEROReconstructor::GetCollisionMode()
+{
+ // Retrieval of collision mode
+
+ TString beamType = GetRunInfo()->GetBeamType();
+ if(beamType==AliGRPObject::GetInvalidString()){
+ AliError("VZERO cannot retrieve beam type");
+ return;
+ }
+
+ if( (beamType.CompareTo("P-P") ==0) || (beamType.CompareTo("p-p") ==0) ){
+ fCollisionMode=0;
+ }
+ else if( (beamType.CompareTo("Pb-Pb") ==0) || (beamType.CompareTo("A-A") ==0) ){
+ fCollisionMode=1;
+ }
+
+ fBeamEnergy = GetRunInfo()->GetBeamEnergy();
+ if(fBeamEnergy==AliGRPObject::GetInvalidFloat()) {
+ AliError("Missing value for the beam energy ! Using 0");
+ fBeamEnergy = 0.;
+ }
+
+ AliDebug(1,Form("\n ++++++ Beam type and collision mode retrieved as %s %d @ %1.3f GeV ++++++\n\n",beamType.Data(), fCollisionMode, fBeamEnergy));
+
+}
+
//_____________________________________________________________________________
AliVZEROCalibData* AliVZEROReconstructor::GetCalibData() const
{
entry = man->Get("VZERO/Calib/Data");
-// if(!entry){
-// AliWarning("Load of calibration data from default storage failed!");
-// AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
-// Int_t runNumber = man->GetRun();
-// entry = man->GetStorage("local://$ALICE_ROOT")
-// ->Get("VZERO/Calib/Data",runNumber);
-//
-// }
-
- // Retrieval of data in directory VZERO/Calib/Data:
-
AliVZEROCalibData *calibdata = 0;
if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
return calibdata;
}
-//_____________________________________________________________________________
-Float_t AliVZEROReconstructor::GetMIP(Int_t channel) const {
-
-// Computes the MIP conversion factor - MIP per ADC channel -
-// Argument passed is the PM number (aliroot numbering)
-
- Float_t P0[64] = {
- 7.094891, 7.124938, 7.089708, 7.098169, 7.094482, 7.147250, 7.170978, 7.183392,
- 7.145760, 7.148096, 7.153840, 7.143544, 7.186069, 7.194580, 7.203516, 7.195176,
- 7.188333, 7.198607, 7.209412, 7.226565, 7.221695, 7.205132, 7.191238, 7.227724,
- 7.232810, 7.252655, 7.230309, 7.273518, 7.273518, 7.242969, 7.252859, 7.252655,
- 7.026802, 7.079913, 7.134147, 7.092387, 7.079561, 7.072848, 7.123192, 7.003141,
- 7.024667, 7.124784, 7.123442, 7.129744, 7.110671, 7.143031, 7.139439, 7.178109,
- 7.247803, 7.139396, 7.293809, 7.094454, 6.992198, 7.206448, 7.244765, 7.056197,
- 7.263595, 7.138569, 7.089582, 7.215683, 7.266183, 7.165123, 7.243276, 7.235135 };
- Float_t P1[64] = {
- 0.135569, 0.146405, 0.142425, 0.144278, 0.142307, 0.141648, 0.128477, 0.138239,
- 0.144173, 0.143419, 0.143572, 0.144482, 0.138024, 0.136542, 0.135955, 0.138537,
- 0.148521, 0.141999, 0.139627, 0.130014, 0.134970, 0.135635, 0.139094, 0.140634,
- 0.137971, 0.142080, 0.142793, 0.142778, 0.142778, 0.146045, 0.139133, 0.142080,
- 0.144121, 0.142311, 0.136564, 0.142686, 0.138792, 0.166285, 0.136387, 0.155391,
- 0.176082, 0.140408, 0.164738, 0.144270, 0.142766, 0.147486, 0.141951, 0.138012,
- 0.132394, 0.142849, 0.140477, 0.144592, 0.141558, 0.157646, 0.143758, 0.173385,
- 0.146489, 0.143279, 0.145230, 0.147203, 0.147333, 0.144979, 0.148597, 0.138985 };
-
-// High Voltage retrieval from Calibration Data Base:
- Float_t HV = fCalibData->GetMeanHV(channel);
- Float_t MIP = 0.5/TMath::Exp((TMath::Log(HV) - P0[channel] )/P1[channel]);
- return MIP;
+Float_t AliVZEROReconstructor::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const
+{
+ // Correct the leading time
+ // for slewing effect and
+ // misalignment of the channels
+ if (time < 1e-6) return kInvalidTime;
+
+ // Channel alignment and general offset subtraction
+ if (i < 32) time -= kV0CDelayCables;
+ time -= fTimeOffset[i];
+
+ // In case of pathological signals
+ if (adc < 1e-6) return time;
+
+ // Slewing correction
+ Float_t thr = fCalibData->GetCalibDiscriThr(i,kTRUE);
+ time -= fTimeSlewing->Eval(adc/thr);
+ return time;
}