#include "TSystem.h"
#include "TROOT.h"
#include "TAxis.h"
+#include "AliGenDPMjetEventHeader.h"
+#include <TFile.h>
+
ClassImp(AliFMDAnalysisTaskGenerateCorrection)
+#if 0
+; // This is for emacs - do not delete
+#endif
//_____________________________________________________________________
AliFMDAnalysisTaskGenerateCorrection::AliFMDAnalysisTaskGenerateCorrection():
//
std::cout<<"Creating output objects"<<std::endl;
+
+ // SelectCollisionCandidates(AliVEvent::kAny);
+
for(Int_t v=0; v<fNvtxBins;v++) {
TH2F* hSPDhits = new TH2F(Form("hSPDhits_vtx%d",v),
hSPDhits->Sumw2();
fListOfHits.Add(hSPDhits);
+ TH1F* hReadChannels = new TH1F(Form("hFMDReadChannels_vtx%d",v),
+ Form("hFMDReadChannels_vtx%d",v),
+ fNbinsEta,-4,6);
+ hReadChannels->Sumw2();
+ fListOfHits.Add(hReadChannels);
+ TH1F* hAllChannels = new TH1F(Form("hFMDAllChannels_vtx%d",v),
+ Form("hFMDAllChannels_vtx%d",v),
+ fNbinsEta,-4,6);
+ hAllChannels->Sumw2();
+ fListOfHits.Add(hAllChannels);
+
+
+
for(Int_t iring = 0; iring<2;iring++) {
Char_t ringChar = (iring == 0 ? 'I' : 'O');
Int_t nSec = (iring == 1 ? 40 : 20);
fNbinsEta, -4,6, nSec, 0,2*TMath::Pi());
hPrimary->Sumw2();
fListOfPrimaries.Add(hPrimary);
+ TH2F* hPrimaryNSD = new TH2F(Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v),
+ Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v),
+ fNbinsEta, -4,6, nSec, 0,2*TMath::Pi());
+ hPrimaryNSD->Sumw2();
+ fListOfPrimaries.Add(hPrimaryNSD);
+
}
fNbinsEta, -4,6, nSec, 0, 2*TMath::Pi());
hHits->Sumw2();
fListOfHits.Add(hHits);
+ TH2F* hHitsNSD = new TH2F(Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v),
+ Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v),
+ fNbinsEta, -4,6, nSec, 0, 2*TMath::Pi());
+ hHitsNSD->Sumw2();
+ fListOfHits.Add(hHitsNSD);
+
}
}
fVertexBins.SetName("VertexBins");
fVertexBins.GetXaxis()->Set(fNvtxBins,-1*fZvtxCut,fZvtxCut);
+
+
}
//_____________________________________________________________________
void AliFMDAnalysisTaskGenerateCorrection::Init()
Double_t esdvertex[3];
Bool_t vtxStatus = pars->GetVertex(esdevent,esdvertex);
+ /* Double_t deltaEsd = 2*fZvtxCut/fNvtxBins;
+ Double_t vertexBinDoubleEsd = (esdvertex[2] + fZvtxCut) / deltaEsd;
+ Int_t vertexBinEsd = (Int_t)vertexBinDoubleEsd;*/
+
AliMCParticle* particle = 0;
AliStack* stack = mcevent->Stack();
AliGenEventHeader* genHeader = header->GenEventHeader();
AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
- if (!pythiaGenHeader) {
- std::cout<<" no pythia header! - NSD selection unusable"<<std::endl;
+ AliGenDPMjetEventHeader* dpmHeader = dynamic_cast<AliGenDPMjetEventHeader*>(header->GenEventHeader());
+
+ if (!pythiaGenHeader && !dpmHeader) {
+ std::cout<<" no pythia or dpm header! - NSD selection unusable"<<std::endl;
//return;
}
Bool_t nsd = kTRUE;
if(pythiaType==92 || pythiaType==93)
nsd = kFALSE;
}
- //if(pythiaType==94){
- // std::cout<<"double diffractive"<<std::endl;
- // return;
- //}
+ if(dpmHeader) {
+ Int_t processType = dpmHeader->ProcessType();
+ if(processType == 5 || processType == 6)
+ nsd = kFALSE;
+
+ }
+
TArrayF vertex;
genHeader->PrimaryVertex(vertex);
// vtxFound = kFALSE;
//}
+
+ if(TMath::Abs(vertex.At(2)) > fZvtxCut) {
+ return;
+ }
+
+
Bool_t isTriggered = pars->IsEventTriggered(AliFMDAnaParameters::kMB1);
Bool_t isTriggeredNSD = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
if(vtxFound && isTriggered) hEventsSelected->Fill(vertexBin);
hEventsAll->Fill(vertexBin);
if(nsd) hEventsAllNSD->Fill(vertexBin);
- if(!vtxFound || !isTriggered) return; //Not important for FMD but crucial for SPD since maps are done from ESD
-
- if(TMath::Abs(vertex.At(2)) > fZvtxCut) {
- return;
+ // FMD dead channels
+
+ TH1F* hFMDReadChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDReadChannels_vtx%d",vertexBin));
+ TH1F* hFMDAllChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDAllChannels_vtx%d",vertexBin));
+
+ AliESDFMD* fmd = esdevent->GetFMDData();
+
+ for(UShort_t d=1;d<=3;d++) {
+ Int_t nRings = (d==1 ? 1 : 2);
+ for (UShort_t ir = 0; ir < nRings; ir++) {
+ Char_t r = (ir == 0 ? 'I' : 'O');
+ UShort_t nsec = (ir == 0 ? 20 : 40);
+ UShort_t nstr = (ir == 0 ? 512 : 256);
+ for(UShort_t s =0; s < nsec; s++) {
+ for(UShort_t str = 0; str < nstr; str++) {
+ Float_t mult = fmd->Multiplicity(d,r,s,str);
+
+ hFMDAllChannels->Fill(pars->GetEtaFromStrip(d,r,s,str,esdvertex[2]));
+
+ if(mult != AliESDFMD::kInvalidMult)
+ hFMDReadChannels->Fill(pars->GetEtaFromStrip(d,r,s,str,esdvertex[2]));
+ }
+ }
+ }
}
-
+ // End, FMD dead channels
+
for(Int_t i = 0 ;i<nTracks;i++) {
particle = (AliMCParticle*) mcevent->GetTrack(i);
if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) {
-
- TH2F* hPrimaryInner = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'I',vertexBin));
- TH2F* hPrimaryOuter = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'O',vertexBin));
- hPrimaryInner->Fill(particle->Eta(),particle->Phi());
- hPrimaryOuter->Fill(particle->Eta(),particle->Phi());
+ if(vtxFound && isTriggered) {
+ TH2F* hPrimaryInner = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'I',vertexBin));
+ TH2F* hPrimaryOuter = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'O',vertexBin));
+ hPrimaryInner->Fill(particle->Eta(),particle->Phi());
+ hPrimaryOuter->Fill(particle->Eta(),particle->Phi());
+ if( isTriggeredNSD) {
+ TH2F* hPrimaryInnerNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",'I',vertexBin));
+ TH2F* hPrimaryOuterNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",'O',vertexBin));
+ hPrimaryInnerNSD->Fill(particle->Eta(),particle->Phi());
+ hPrimaryOuterNSD->Fill(particle->Eta(),particle->Phi());
+ }
+ }
TH2F* hAnalysedInner = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'I',vertexBin));
TH2F* hAnalysedOuter = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'O',vertexBin));
TH2F* hAnalysedNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'I',vertexBin));
hAnalysedNSDInner->Fill(particle->Eta(),particle->Phi());
hAnalysedNSDOuter->Fill(particle->Eta(),particle->Phi());
}
- if(isTriggered) {
+ if(isTriggered && vtxFound) {
hAnalysedInner->Fill(particle->Eta(),particle->Phi());
hAnalysedOuter->Fill(particle->Eta(),particle->Phi());
}
hNSDOuter->Fill(particle->Eta(),particle->Phi());
}
}
+ if(!vtxFound || !isTriggered) continue;
for(Int_t j=0; j<particle->GetNumberOfTrackReferences();j++) {
TH2F* hHits = (TH2F*)fListOfHits.FindObject(Form("hHits_FMD%d%c_vtx%d", det,ring,vertexBin));
hHits->Fill(eta,phi);
+ if( isTriggeredNSD) {
+ TH2F* hHitsNSD = (TH2F*)fListOfHits.FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ring,vertexBin));
+ hHitsNSD->Fill(eta,phi);
+ }
+
Float_t nstrips = (ring =='O' ? 256 : 512);
fHitsByStrip(det,ring,sec,strip) +=1;
TH1F* allHits = (TH1F*)fListOfHits.FindObject(Form("allHits_FMD%d%c",det,ring));
}
- //SPD part HHD
- TH2F* hSPDMult = (TH2F*)fListOfHits.FindObject(Form("hSPDhits_vtx%d", vertexBin));
-
- const AliMultiplicity* spdmult = esdevent->GetMultiplicity();
- for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++)
- hSPDMult->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
- for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++)
- hSPDMult->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
+ if(vtxFound && isTriggered) {
+ //SPD part HHD
+ TH2F* hSPDMult = (TH2F*)fListOfHits.FindObject(Form("hSPDhits_vtx%d", vertexBin));
+
+ const AliMultiplicity* spdmult = esdevent->GetMultiplicity();
+ for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++)
+ hSPDMult->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
+
+ for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++)
+ hSPDMult->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
-
+ }
+
PostData(1, &fListOfHits);
PostData(2, &fListOfPrimaries);
PostData(3, &fVertexBins);
hNSDOuter->Scale((hEventsAllNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAllNSD->GetBinContent(v+1)));
-
- //hAnalysedInner->Scale(1./0.84); //numbers for real data, run104892
- //hAnalysedOuter->Scale(1./0.84);
hAnalysedInner->Divide(hInelInner);
hAnalysedOuter->Divide(hInelOuter);
fEventSelectionEff->SetCorrection("NSD",v,'I',hAnalysedNSDInner);
fEventSelectionEff->SetCorrection("NSD",v,'O',hAnalysedNSDOuter);
+ //FMD dead channels
+ TH1F* hFMDReadChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDReadChannels_vtx%d",v));
-}
+ TH1F* hFMDAllChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDAllChannels_vtx%d",v));
+ if(hFMDReadChannels) {
+ TH1F* hFMDDeadCorrection = (TH1F*)hFMDReadChannels->Clone("hFMDDeadCorrection");
+ hFMDDeadCorrection->Divide(hFMDAllChannels);
+ fBackground->SetFMDDeadCorrection(v,hFMDDeadCorrection);
+ fListOfCorrection.Add(hFMDDeadCorrection);
+ }
+ else AliWarning("No Dead Channel Correction generated");
+
+ }
Float_t vtxEff = 1;
if(hEventsSelectedTrigger->GetEntries())
for(Int_t vertexBin=0;vertexBin<fNvtxBins ;vertexBin++) {
TH2F* hHits = (TH2F*)fListOfHits.FindObject(Form("hHits_FMD%d%c_vtx%d", det,ring,vertexBin));
- TH2F* hPrimary = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",ring,vertexBin));
- TH2F* hCorrection = (TH2F*)hHits->Clone(Form("FMD%d%c_vtxbin_%d_correction",det,ring,vertexBin));
+ TH2F* hPrimary = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",ring,vertexBin));
+ TH2F* hCorrection = (TH2F*)hHits->Clone(Form("FMD%d%c_vtxbin_%d_correction",det,ring,vertexBin));
hCorrection->Divide(hPrimary);
-
+
+ TH2F* hHitsNSD = (TH2F*)fListOfHits.FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ring,vertexBin));
+ TH2F* hPrimaryNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",ring,vertexBin));
+ TH2F* hCorrectionNSD = 0;
+ if(hHitsNSD && hPrimaryNSD) {
+ hCorrectionNSD = (TH2F*)hHitsNSD->Clone(Form("FMDNSD%d%c_vtxbin_%d_correction",det,ring,vertexBin));
+ hCorrectionNSD->Divide(hPrimaryNSD);
+ }
hCorrection->SetTitle(hCorrection->GetName());
fListOfCorrection.Add(hCorrection);
fBackground->SetBgCorrection(det,ring,vertexBin,hCorrection);
+ if(hCorrectionNSD) {
+ fBackground->SetNSDBgCorrection(det,ring,vertexBin,hCorrectionNSD);
+ hCorrectionNSD->SetTitle(hCorrectionNSD->GetName());
+ fListOfCorrection.Add(hCorrectionNSD);
+ }
}
hCorrection->SetTitle(hCorrection->GetName());
fListOfCorrection.Add(hCorrection);
hCorrection->Divide(hPrimary);
- fBackground->SetBgCorrection(0,'Q',vertexBin,hCorrection);
+
TH1F* hAlive = new TH1F(Form("hAliveSPD_vtxbin%d",vertexBin),Form("hAliveSPD_vtxbin%d",vertexBin),hSPDMult->GetNbinsX(),hSPDMult->GetXaxis()->GetXmin(), hSPDMult->GetXaxis()->GetXmax());
TH1F* hPresent = new TH1F(Form("hPresentSPD_vtxbin%d",vertexBin),Form("hPresentSPD_vtxbin%d",vertexBin),hSPDMult->GetNbinsX(),hSPDMult->GetXaxis()->GetXmin(), hSPDMult->GetXaxis()->GetXmax());
for(Int_t xx = 1; xx <=hSPDMult->GetNbinsX(); xx++) {
- if(TMath::Abs(hCorrection->GetXaxis()->GetBinCenter(xx)) > 2)
- continue;
+
+
for(Int_t yy = 1; yy <=hSPDMult->GetNbinsY(); yy++) {
- if(hCorrection->GetBinContent(xx,yy) > 0.1)
- hAlive->Fill(hCorrection->GetXaxis()->GetBinCenter(xx));
+ if(TMath::Abs(hCorrection->GetXaxis()->GetBinCenter(xx)) > 1.9) {
+ hCorrection->SetBinContent(xx,yy,0.);
+ hCorrection->SetBinError(xx,yy,0.);
+ }
+
+ if(hCorrection->GetBinContent(xx,yy) > 0.9) {
+ hAlive->Fill(hCorrection->GetXaxis()->GetBinCenter(xx) );
+ }
+ else {
+ hCorrection->SetBinContent(xx,yy,0.);
+ hCorrection->SetBinError(xx,yy,0.);
+ }
+
hPresent->Fill(hCorrection->GetXaxis()->GetBinCenter(xx));
}
hDeadCorrection->Divide(hPresent);
fBackground->SetSPDDeadCorrection(vertexBin,hDeadCorrection);
fListOfCorrection.Add(hDeadCorrection);
- }
-
-
-
+ fBackground->SetBgCorrection(0,'Q',vertexBin,hCorrection);
+ }
TAxis refAxis(fNvtxBins,-1*fZvtxCut,fZvtxCut);
TH2F* hHits = (TH2F*)listOfHits->FindObject(Form("hHits_FMD%d%c_vtx%d", det,ringChar,v));
fListOfHits.Add(hHits);
+ TH2F* hHitsNSD = (TH2F*)listOfHits->FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v));
+ if(hHitsNSD)
+ fListOfHits.Add(hHitsNSD);
}
}
}
for(Int_t v=0; v<fNvtxBins;v++) {
TH2F* hSPDHits = (TH2F*)listOfHits->FindObject(Form("hSPDhits_vtx%d", v));
fListOfHits.Add(hSPDHits);
+ TH1F* hFMDReadChannels = (TH1F*)listOfHits->FindObject(Form("hFMDReadChannels_vtx%d",v));
+ TH1F* hFMDAllChannels = (TH1F*)listOfHits->FindObject(Form("hFMDAllChannels_vtx%d",v));
+ if(hFMDReadChannels && hFMDAllChannels) {
+ fListOfHits.Add(hFMDReadChannels);
+ fListOfHits.Add(hFMDAllChannels);
+ }
for(Int_t iring = 0; iring<2;iring++) {
Char_t ringChar = (iring == 0 ? 'I' : 'O');
TH2F* hPrimary = (TH2F*)listOfPrim->FindObject( Form("hPrimary_FMD_%c_vtx%d",ringChar,v));
+ TH2F* hPrimaryNSD = (TH2F*)listOfPrim->FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v));
+
TH2F* hAnalysed = (TH2F*)listOfPrim->FindObject(Form("Analysed_FMD%c_vtx%d",ringChar,v));
TH2F* hAnalysedNSD = (TH2F*)listOfPrim->FindObject(Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v));
TH2F* hInel = (TH2F*)listOfPrim->FindObject(Form("Inel_FMD%c_vtx%d",ringChar,v));
TH2F* hNSD = (TH2F*)listOfPrim->FindObject(Form("NSD_FMD%c_vtx%d",ringChar,v));
fListOfPrimaries.Add(hPrimary);
+ if(hPrimaryNSD)
+ fListOfPrimaries.Add(hPrimaryNSD);
fListOfPrimaries.Add(hAnalysed);
fListOfPrimaries.Add(hInel);
fListOfPrimaries.Add(hAnalysedNSD);
fout.Close();
AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
- if(storeInOCDB) {
- TFile fbg(pars->GetPath(pars->GetBackgroundID()),"RECREATE");
- fBackground->Write(AliFMDAnaParameters::GetBackgroundID());
- fbg.Close();
- TFile feselect(pars->GetPath(pars->GetEventSelectionEffID()),"RECREATE");
- fEventSelectionEff->Write(AliFMDAnaParameters::GetEventSelectionEffID());
- feselect.Close();
-
+ if (!storeInOCDB) {
+ pars->SetBackgroundPath(".");
+ pars->SetEnergyPath(".");
+ pars->SetEventSelectionPath(".");
+ pars->SetSharingEfficiencyPath(".");
}
-
-
-
-
+ AliInfo(Form("Generating %s", pars->GetPath(pars->GetBackgroundID())));
+ TFile fbg(pars->GetPath(pars->GetBackgroundID()),"RECREATE");
+ fBackground->Write(AliFMDAnaParameters::GetBackgroundID());
+ fbg.Close();
+
+ AliInfo(Form("Generating %s", pars->GetPath(pars->GetEventSelectionEffID())));
+ TFile feselect(pars->GetPath(pars->GetEventSelectionEffID()),"RECREATE");
+ fEventSelectionEff->Write(AliFMDAnaParameters::GetEventSelectionEffID());
+ feselect.Close();
}
//_____________________________________________________________________
//