+void AliAnalysisTaskJetV2::ReadVZEROCalibration2010h()
+{
+ // necessary for calibration of 10h vzero event plane. code copied from flow package
+ // (duplicate, but i didn't want to introduce an ulgy dependency )
+ // this function is only called when the runnumber changes
+ if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
+
+ // 1) check if the proper chi weights for merging vzero a and vzero c ep are present
+ // if not, use sane defaults. centrality binning is equal to that given in the fVZEROcentralityBin snippet
+ //
+ // chi values can be calculated using the static helper function
+ // AliAnalysisTaskJetV2::CalculateEventPlaneChi(Double_t res) where res is the event plane
+ // resolution in a given centrality bin
+ //
+ // the resolutions that were used for these defaults are
+ // this might need a bit of updating as they were read 'by-eye' from a performance plot ..
+ // Double_t R2VZEROA[] = {.35, .40, .48, .50, .48, .45, .38, .26, .16};
+ // Double_t R2VZEROC[] = {.45, .60, .70, .73, .68, .60, .40, .36, .17};
+ // Double_t R3VZEROA[] = {.22, .23, .22, .19, .15, .12, .08, .00, .00};
+ // Double_t R3VZEROC[] = {.30, .30, .28, .25, .22, .17, .11, .00, .00};
+
+ Double_t chiC2[] = {0.771423, 1.10236, 1.38116, 1.48077, 1.31964, 1.10236, 0.674622, 0.600403, 0.273865};
+ Double_t chiA2[] = {0.582214, 0.674622, 0.832214, 0.873962, 0.832214, 0.771423, 0.637146, 0.424255, 0.257385};
+ Double_t chiC3[] = {0.493347, 0.493347, 0.458557, 0.407166, 0.356628, 0.273865, 0.176208, 6.10352e-05, 6.10352e-05};
+ Double_t chiA3[] = {0.356628, 0.373474, 0.356628, 0.306702, 0.24115, 0.192322, 0.127869, 6.10352e-05, 6.10352e-05};
+
+ if(!fChi2A) fChi2A = new TArrayD(9, chiA2);
+ if(!fChi2C) fChi2C = new TArrayD(9, chiC2);
+ if(!fChi3A) fChi3A = new TArrayD(9, chiA3);
+ if(!fChi3C) fChi3C = new TArrayD(9, chiC3);
+
+ // 2) open database file
+ fOADB = TFile::Open("$ALICE_ROOT/OADB/PWGCF/VZERO/VZEROcalibEP.root");
+ if(fOADB->IsZombie()){
+ printf("OADB file $ALICE_ROOT/OADB/PWGCF/VZERO/VZEROcalibEP.root cannot be opened, CALIBRATION FAILED !");
+ return;
+ }
+
+ AliOADBContainer *cont = (AliOADBContainer*) fOADB->Get("hMultV0BefCorr");
+ if(!cont){
+ // see if database is readable
+ printf("OADB object hMultV0BefCorr is not available in the file\n");
+ return;
+ }
+ Int_t run(fRunNumber);
+ if(!(cont->GetObject(run))){
+ // if the run isn't recognized fall back to a default run
+ printf("OADB object hMultVZEROBefCorr is not available for run %i (used default run 137366)\n",run);
+ run = 137366;
+ }
+ // step 3) get the proper multiplicity weights from the vzero signal
+ fVZEROgainEqualization = ((TH2F*)cont->GetObject(run))->ProfileX();
+ if(!fVZEROgainEqualization) {
+ AliFatal(Form("%s: Fatal error, couldn't read fVZEROgainEqualization from OADB object < \n", GetName()));
+ return;
+ }
+
+ TF1* fpol0 = new TF1("fpol0","pol0");
+ if(fVZEROgainEqualizationPerRing) {
+ // do the calibration per ring
+ // start with the vzero c rings (segments 0 through 31)
+ fVZEROgainEqualization->Fit(fpol0, "", "", 0, 8);
+ (fUseVZERORing[0]) ? SetVZEROCpol(0, fpol0->GetParameter(0)) : SetVZEROCpol(0, 0.);
+ fVZEROgainEqualization->Fit(fpol0, "", "", 8, 16);
+ (fUseVZERORing[1]) ? SetVZEROCpol(1, fpol0->GetParameter(0)) : SetVZEROCpol(1, 0.);
+ fVZEROgainEqualization->Fit(fpol0, "", "", 16, 24);
+ (fUseVZERORing[2]) ? SetVZEROCpol(2, fpol0->GetParameter(0)) : SetVZEROCpol(2, 0.);
+ fVZEROgainEqualization->Fit(fpol0, "", "", 24, 32);
+ (fUseVZERORing[3]) ? SetVZEROCpol(3, fpol0->GetParameter(0)) : SetVZEROCpol(3, 0.);
+ // same thing for vero A
+ fVZEROgainEqualization->Fit(fpol0, "", "", 32, 40);
+ (fUseVZERORing[4]) ? SetVZEROApol(0, fpol0->GetParameter(0)) : SetVZEROApol(0, 0.);
+ fVZEROgainEqualization->Fit(fpol0, "", "", 40, 48);
+ (fUseVZERORing[5]) ? SetVZEROApol(1, fpol0->GetParameter(0)) : SetVZEROApol(1, 0.);
+ fVZEROgainEqualization->Fit(fpol0, "", "", 48, 56);
+ (fUseVZERORing[6]) ? SetVZEROApol(2, fpol0->GetParameter(0)) : SetVZEROApol(2, 0.);
+ fVZEROgainEqualization->Fit(fpol0, "", "", 56, 64);
+ (fUseVZERORing[7]) ? SetVZEROApol(3, fpol0->GetParameter(0)) : SetVZEROApol(3, 0.);
+ } else {
+ // do the calibration in one go. the calibration will still be
+ // stored per ring, but each ring has the same weight now
+ // this should be the default for the analysis as the database is tuned to this configuration
+ fVZEROgainEqualization->Fit(fpol0,"","",0,31);
+ for(Int_t i(0); i < 4; i++) SetVZEROCpol(i, fpol0->GetParameter(0));
+ fVZEROgainEqualization->Fit(fpol0,"","",32,64);
+ for(Int_t i(0); i < 4; i++) SetVZEROApol(i, fpol0->GetParameter(0));
+ }
+
+ // step 4) extract the information to re-weight the q-vectors
+ for(Int_t iside=0;iside<2;iside++){
+ for(Int_t icoord=0;icoord<2;icoord++){
+ for(Int_t i=0;i < 9;i++){
+ char namecont[100];
+ if(iside==0 && icoord==0)
+ snprintf(namecont,100,"hQxc2_%i",i);
+ else if(iside==1 && icoord==0)
+ snprintf(namecont,100,"hQxa2_%i",i);
+ else if(iside==0 && icoord==1)
+ snprintf(namecont,100,"hQyc2_%i",i);
+ else if(iside==1 && icoord==1)
+ snprintf(namecont,100,"hQya2_%i",i);
+
+ cont = (AliOADBContainer*) fOADB->Get(namecont);
+ if(!cont){
+ printf("OADB object %s is not available in the file\n",namecont);
+ return;
+ }
+
+ if(!(cont->GetObject(run))){
+ printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
+ run = 137366;
+ }
+
+ // store info for all centralities to cache
+ fMeanQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
+ fWidthQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
+
+ //for v3
+ if(iside==0 && icoord==0)
+ snprintf(namecont,100,"hQxc3_%i",i);
+ else if(iside==1 && icoord==0)
+ snprintf(namecont,100,"hQxa3_%i",i);
+ else if(iside==0 && icoord==1)
+ snprintf(namecont,100,"hQyc3_%i",i);
+ else if(iside==1 && icoord==1)
+ snprintf(namecont,100,"hQya3_%i",i);
+
+ cont = (AliOADBContainer*) fOADB->Get(namecont);
+ if(!cont){
+ printf("OADB object %s is not available in the file\n",namecont);
+ return;
+ }
+
+ if(!(cont->GetObject(run))){
+ printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
+ run = 137366;
+ }
+ // store info for all centralities to cache
+ fMeanQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
+ fWidthQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
+ }
+ }
+ }
+ // cleanup. the opened file is closed in the destructor, otherwise fVZEROgainEqualization is no longer available
+ delete fpol0;
+}
+//_____________________________________________________________________________
+Int_t AliAnalysisTaskJetV2::GetVZEROCentralityBin() const
+{
+ // return cache index number corresponding to the event centrality
+ if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
+ Float_t v0Centr(InputEvent()->GetCentrality()->GetCentralityPercentile("V0M"));
+ if(v0Centr < 5) return 0;
+ else if(v0Centr < 10) return 1;
+ else if(v0Centr < 20) return 2;
+ else if(v0Centr < 30) return 3;
+ else if(v0Centr < 40) return 4;
+ else if(v0Centr < 50) return 5;
+ else if(v0Centr < 60) return 6;
+ else if(v0Centr < 70) return 7;
+ else return 8;
+}
+//_____________________________________________________________________________