+void AliFlowAnalysisWithMultiparticleCorrelations::SetnBins(const char *type, const char *variable, Int_t nBins)
+{
+ // Set number of bins for histograms fKinematicsHist[2][3].
+
+ TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetnBins(const char *type, const char *variable, Int_t nBins)";
+
+ // Basic protection:
+ if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI")))
+ {
+ cout<<"Well, it would be better for you to use RP or POI here..."<<endl;
+ Fatal(sMethodName.Data(),"!(TString(type).EqualTo... type = %s ",type);
+ }
+ if(!(TString(variable).EqualTo("phi") || TString(variable).EqualTo("pt") || TString(variable).EqualTo("eta")))
+ {
+ cout<<"phi, pt or eta, please!"<<endl;
+ Fatal(sMethodName.Data(),"!(TString(variable).EqualTo... variable = %s ",variable);
+ }
+
+ Int_t rp = 0; // [RP,POI]
+ if(TString(type).EqualTo("POI")){rp=1;}
+
+ Int_t ppe = 0; // [phi,pt,eta]
+ if(TString(variable).EqualTo("pt")){ppe=1;}
+ if(TString(variable).EqualTo("eta")){ppe=2;}
+
+ fnBins[rp][ppe] = nBins;
+
+} // void AliFlowAnalysisWithMultiparticleCorrelations::SetnBins(const char *type, const char *variable, Int_t nBins)
+
+//=======================================================================================================================
+
+void AliFlowAnalysisWithMultiparticleCorrelations::SetMin(const char *type, const char *variable, Double_t min)
+{
+ // Set min bin range for histograms fKinematicsHist[2][3].
+
+ TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetMin(const char *type, const char *variable, Double_t min)";
+
+ // Basic protection:
+ if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI")))
+ {
+ cout<<"Well, it would be better for you to use RP or POI here..."<<endl;
+ Fatal(sMethodName.Data(),"!(TString(type).EqualTo... type = %s ",type);
+ }
+ if(!(TString(variable).EqualTo("phi") || TString(variable).EqualTo("pt") || TString(variable).EqualTo("eta")))
+ {
+ cout<<"phi, pt or eta, please!"<<endl;
+ Fatal(sMethodName.Data(),"!(TString(variable).EqualTo... variable = %s ",variable);
+ }
+
+ Int_t rp = 0; // [RP,POI]
+ if(TString(type).EqualTo("POI")){rp=1;}
+
+ Int_t ppe = 0; // [phi,pt,eta]
+ if(TString(variable).EqualTo("pt")){ppe=1;}
+ if(TString(variable).EqualTo("eta")){ppe=2;}
+
+ fMin[rp][ppe] = min;
+
+} // void AliFlowAnalysisWithMultiparticleCorrelations::SetMin(const char *type, const char *variable, Double_t min)
+
+//=======================================================================================================================
+
+void AliFlowAnalysisWithMultiparticleCorrelations::SetMax(const char *type, const char *variable, Double_t max)
+{
+ // Set max bin range for histograms fKinematicsHist[2][3].
+
+ TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetMax(const char *type, const char *variable, Double_t max)";
+
+ // Basic protection:
+ if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI")))
+ {
+ cout<<"Well, it would be better for you to use RP or POI here..."<<endl;
+ Fatal(sMethodName.Data(),"!(TString(type).EqualTo... type = %s ",type);
+ }
+ if(!(TString(variable).EqualTo("phi") || TString(variable).EqualTo("pt") || TString(variable).EqualTo("eta")))
+ {
+ cout<<"phi, pt or eta, please!"<<endl;
+ Fatal(sMethodName.Data(),"!(TString(variable).EqualTo... variable = %s ",variable);
+ }
+
+ Int_t rp = 0; // [RP,POI]
+ if(TString(type).EqualTo("POI")){rp=1;}
+
+ Int_t ppe = 0; // [phi,pt,eta]
+ if(TString(variable).EqualTo("pt")){ppe=1;}
+ if(TString(variable).EqualTo("eta")){ppe=2;}
+
+ fMax[rp][ppe] = max;
+
+} // void AliFlowAnalysisWithMultiparticleCorrelations::SetMax(const char *type, const char *variable, Double_t min)
+
+//=======================================================================================================================
+
+void AliFlowAnalysisWithMultiparticleCorrelations::SetnBinsMult(const char *type, Int_t nBinsMult)
+{
+ // Set number of bins for histograms fMultDistributionsHist[3].
+
+ TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetnBinsMult(const char *type, Int_t nBinsMult)";
+
+ // Basic protection:
+ if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI") || TString(type).EqualTo("REF")))
+ {
+ cout<<"Well, it would be better for you to use RP, POI or REF here..."<<endl;
+ Fatal(sMethodName.Data(),"!(TString(type).EqualTo... type = %s ",type);
+ }
+
+ Int_t rpr = 0; // [RP,POI,REF]
+ if(TString(type).EqualTo("POI")){rpr=1;}
+ else if(TString(type).EqualTo("REF")){rpr=2;}
+
+ fnBinsMult[rpr] = nBinsMult;
+
+} // void AliFlowAnalysisWithMultiparticleCorrelations::SetnBinsMult(const char *type, Int_t nBinsMult)
+
+//=======================================================================================================================
+
+void AliFlowAnalysisWithMultiparticleCorrelations::SetMinMult(const char *type, Double_t minMult)
+{
+ // Set min bin range for histograms fMultDistributionsHist[3].
+
+ TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetMinMult(const char *type, Double_t minMult)";
+
+ // Basic protection:
+ if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI") || TString(type).EqualTo("REF")))
+ {
+ cout<<"Well, it would be better for you to use RP, POI or REF here..."<<endl;
+ Fatal(sMethodName.Data(),"!(TString(type).EqualTo... type = %s ",type);
+ }
+
+ Int_t rpr = 0; // [RP,POI,REF]
+ if(TString(type).EqualTo("POI")){rpr=1;}
+ else if(TString(type).EqualTo("REF")){rpr=2;}
+
+ fMinMult[rpr] = minMult;
+
+} // void AliFlowAnalysisWithMultiparticleCorrelations::SetMinMult(const char *type, Double_t minMult)
+
+//=======================================================================================================================
+
+void AliFlowAnalysisWithMultiparticleCorrelations::SetMaxMult(const char *type, Double_t maxMult)
+{
+ // Set max bin range for histograms fMultDistributionsHist[3].
+
+ TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetMaxMult(const char *type, Double_t maxMult)";
+
+ // Basic protection:
+ if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI") || TString(type).EqualTo("REF")))
+ {
+ cout<<"Well, it would be better for you to use RP, POI or REF here..."<<endl;
+ Fatal(sMethodName.Data(),"!(TString(type).EqualTo... type = %s ",type);
+ }
+
+ Int_t rpr = 0; // [RP,POI,REF]
+ if(TString(type).EqualTo("POI")){rpr=1;}
+ else if(TString(type).EqualTo("REF")){rpr=2;}
+
+ fMaxMult[rpr] = maxMult;
+
+} // void AliFlowAnalysisWithMultiparticleCorrelations::SetMaxMult(const char *type, Double_t minMult)
+
+//=======================================================================================================================
+
+void AliFlowAnalysisWithMultiparticleCorrelations::DumpThePoints(AliFlowEventSimple *anEvent)
+{
+ // Dump the points into the external file.
+
+ // Dumping format:
+ // Event <eventNo> Multiplicity <multRP>
+ // phi pt eta
+
+ TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::DumpThePoints(AliFlowEventSimple *anEvent)";
+
+ // Basic protection:
+ if(!anEvent){Fatal(sMethodName.Data(),"if(!anEvent)");}
+ if(!fMultDistributionsHist[0]){Fatal(sMethodName.Data(),"if(!fMultDistributionsHist[0])");}
+ if(fMaxNoEventsPerFile<=0){Fatal(sMethodName.Data(),"if(fMaxNoEventsPerFile<=0)");}
+
+ // Determine event number and multiplicity:
+ Int_t eventNo = (Int_t) fMultDistributionsHist[0]->GetEntries(); // TBI this is a little bit shaky...
+ Int_t multRP = (Int_t) anEvent->GetNumberOfRPs(); // TBI shall I promote this variable into data member?
+
+ // Determine external file name:
+ Int_t fileCounter = (Int_t)((eventNo-1)/fMaxNoEventsPerFile);
+ TString filename = Form("%s_%d.dat",fAnalysisTag.Data(),fileCounter);
+
+ // Open external file and dump:
+ ofstream myfile;
+ myfile.open(filename.Data(),ios::app);
+ myfile << Form("Event %d Multiplicity %d\n",eventNo,multRP);
+ Int_t nTracks = (Int_t) anEvent->NumberOfTracks();
+ Double_t dPhi = 0., dPt = 0., dEta = 0.;
+ for(Int_t t=0;t<nTracks;t++) // loop over all tracks
+ {
+ AliFlowTrackSimple *pTrack = anEvent->GetTrack(t);
+ if(!pTrack){printf("\n AAAARGH: pTrack is NULL in MPC::DumpThePoints(AliFlowEventSimple *anEvent) !!!!"); continue;}
+ if(pTrack->InRPSelection())
+ {
+ dPhi = pTrack->Phi();
+ dPt = pTrack->Pt();
+ dEta = pTrack->Eta();
+ myfile<<Form("%f %f %f\n",dPhi,dPt,dEta);
+ //cout<<Form("%f %f %f",dPhi,dPt,dEta)<<endl;
+ }
+ } // for(Int_t t=0;t<nTracks;t++) // loop over all tracks
+ myfile<<"\n";
+ myfile.close();
+
+} // void AliFlowAnalysisWithMultiparticleCorrelations::DumpThePoints(AliFlowEventSimple *anEvent)
+
+//=======================================================================================================================
+
+TH1D *AliFlowAnalysisWithMultiparticleCorrelations::GetHistogramWithWeights(const char *filePath, const char *listName, const char *type, const char *variable, const char *production)
+{
+ // Access from external ROOT file the desired histogram with weights.
+
+ // a) Return value;
+ // b) Method name;
+ // c) Basic protection for arguments;
+ // d) Check if the external ROOT file exists at specified path;
+ // e) Access the external ROOT file and fetch the desired histogram with weights;
+ // f) Close the external ROOT file.
+
+ // a) Return value:
+ TH1D *hist = NULL;
+
+ // b) Method name:
+ TString sMethodName = "Double_t AliFlowAnalysisWithMultiparticleCorrelations::GetHistogramWithWeights(const char *filePath, const char *listName, const char *type, const char *variable, const char *production)";
+
+ // c) Basic protection for arguments:
+ if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI"))){Fatal(sMethodName.Data(),"!(TString(type).EqualTo...");}
+ if(!(TString(variable).EqualTo("phi") || TString(variable).EqualTo("pt") || TString(variable).EqualTo("eta"))){Fatal(sMethodName.Data(),"!(TString(variable).EqualTo...");}
+ if(!(TString(production).EqualTo("data") || TString(production).BeginsWith("LHC"))){Fatal(sMethodName.Data(),"!(TString(production).EqualTo...");}
+
+ // d) Check if the external ROOT file exists at specified path:
+ if(gSystem->AccessPathName(filePath,kFileExists))
+ {
+ Fatal(sMethodName.Data(),"if(gSystem->AccessPathName(filePath,kFileExists)), filePath = %s",filePath);
+ }
+
+ // e) Access the external ROOT file and fetch the desired histogram with weights:
+ TFile *weightsFile = TFile::Open(filePath,"READ");
+ TList *weightsFileLOK = weightsFile->GetListOfKeys();
+ if(!weightsFileLOK || weightsFileLOK->GetEntries() != 1) // TBI get rid of the 2nd condition at some point...
+ {
+ //printf("\n => if(!weightsFileLOK || weightsFileLOK->GetEntries() != 1)\n\n");
+ Fatal(sMethodName.Data(),"if(!weightsFileLOK || weightsFileLOK->GetEntries() != 1)");
+ }
+ // Access TDirectoryFile "weightsMPCanalysis":
+ TDirectoryFile *directoryFile = dynamic_cast<TDirectoryFile*>(weightsFile->Get("weightsMPCanalysis"));
+ if(!directoryFile)
+ {
+ //printf("\n => if(!directoryFile)\n\n");
+ Fatal(sMethodName.Data(),"if(!directoryFile)");
+ }
+ // Access the specified list:
+ TList *list = dynamic_cast<TList*>(directoryFile->Get(listName));
+ if(!list)
+ {
+ cout<<Form("listName = %s",listName)<<endl;
+ Warning(sMethodName.Data(),"if(!list)");
+ return NULL;
+ }
+ // Finally, access the desired histogram:
+ hist = dynamic_cast<TH1D*>(list->FindObject(Form("%s,%s,%s",type,variable,production)));
+ if(!hist)
+ {
+ //printf("\n => if(!hist)\n\n");
+ Warning(sMethodName.Data(),"if(!hist)");
+ return NULL;
+ } else { hist->SetDirectory(0); }
+
+ // f) Close the external ROOT file:
+ weightsFile->Close(); delete weightsFile;
+
+ return hist;
+
+} // TH1D *AliFlowAnalysisWithMultiparticleCorrelations::GetHistogramWithWeights(const char *filePath, const char *listName, const char *type, const char *variable, const char *production)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+