/** * Create our tasks. This uses the interpreter to make the object. * * @param mgr */ void CreateTasks(AliAnalysisManager* mgr) { Info("CreateTasks", "Loading code"); fRailway->LoadSource("FixPaths.C"); fRailway->LoadSource("AliAODSimpleHeader.C"); fRailway->LoadSource("AliAODTracklet.C"); fRailway->LoadSource("AliTrackletWeights.C"); fRailway->LoadSource("AliTrackletAODUtils.C"); fRailway->LoadSource("AliTrackletAODdNdeta.C"); // --- Create the task using interpreter ------------------------- Bool_t mc = fOptions.Has("mc"); if (!mc) mc = fRailway->IsMC(); Long_t ret = gROOT->ProcessLine(Form("AliTrackletAODdNdeta::Create(%d,\"%s\")",mc, fOptions.AsString("reweigh"))); AliAnalysisTaskSE* task = reinterpret_cast<AliAnalysisTaskSE*>(ret); if (!task) return; // --- Figure out the trigger options ---------------------------- TString trg = fOptions.Get("trig"); trg.ToUpper(); UInt_t sel = AliVEvent::kINT7; if (trg.EqualTo("MB")) sel = AliVEvent::kMB; else if (trg.EqualTo("V0AND")) sel = AliVEvent::kINT7; else if (trg.EqualTo("V0OR")) sel = AliVEvent::kCINT5; else if (trg.EqualTo("ANY")) sel = AliVEvent::kAny; task->SelectCollisionCandidates(sel); // --- Figure out calculation mode ------------------------------- TString calc = fOptions.Get("reweigh-calc"); calc.ToUpper(); UChar_t mcal = 0; if (calc.BeginsWith("PROD")) mcal = 0; else if (calc.BeginsWith("SQ")) mcal = 1; else if (calc.BeginsWith("SUM")) mcal = 2; else if (calc.BeginsWith("AV")) mcal = 3; // --- Set various options on task ------------------------------- const char* defCent = DefaultCentBins(); FromOption(task, "CentralityMethod","cent", "V0M"); FromOption(task, "CentralityAxis", "cent-bins", defCent); FromOption(task, "AbsMinCent", "abs-min-cent", -1.); FromOption(task, "MaxNTracklet", "max-ntracklet", 6000.); FromOption(task, "EtaAxis", "eta-bins", "r16:2"); FromOption(task, "IPzAxis", "ipz-bins", "u15"); FromOption(task, "DeltaCut", "delta-cut", 1.5); FromOption(task, "TailDelta", "tail-delta", 5.); FromOption(task, "TailMaximum", "tail-max", -1); FromOption(task, "MaxDelta", "max-delta", 25.); FromOption(task, "DPhiShift", "dphi-shift", 0.0045); FromOption(task, "ShiftedDPhiCut", "shifted-dphi-cut",-1.); FromOption(task, "WeightMask", "reweigh-mask", 0xFF); FromOption(task, "WeightVeto", "reweigh-veto", 0x0); SetOnTask (task, "WeightCalc", mcal); FromOption(task, "WeightInverse", "reweigh-inv", false); task->Print(""); }
KVElementDensity* KVElementDensityTable::FindElementBySymbol(const Char_t* X) const { // Search table for an element with the given symbol. Case-insensitive. TString x = X; x.ToUpper(); TIter next(tobj); KVElementDensity* elem; while ((elem = (KVElementDensity*)next())) { TString el = elem->GetElementSymbol(); el.ToUpper(); if (x == el) return elem; } return 0x0; }
//___________________________________________________ void KVClassFactory::WritePreProc(ofstream & file) { //Write pre-processor directives in file //i.e. '#ifndef __TOTO_H' etc. //If this class has inheritance, we add '#include "base_class.h"' for each of the base classes. //and any other include files added using AddHeaderIncludeFile TString tmp = fClassName; tmp.ToUpper(); tmp.Prepend("__"); tmp.Append("_H"); file << "#ifndef " << tmp.Data() << endl; file << "#define " << tmp.Data() << "\n" << endl; //base class(es) ? if (fHasBaseClass) { if(WithMultipleBaseClasses()){ fBaseClassName.Begin(","); while( !fBaseClassName.End() ) file << "#include \"" << fBaseClassName.Next(kTRUE) << ".h\"" << endl; file << endl; } else file << "#include \"" << fBaseClassName.Data() << ".h\"\n" << endl; } if( fHeadInc.GetSize() ){ TIter next(&fHeadInc); TObjString* str; while( (str = (TObjString*)next()) ){ file << "#include \"" << str->String().Data() << "\"\n" << endl; } } }
void KVDMSDataRepository::DeleteFile(KVDataSet*ds, const Char_t * datatype, const Char_t * filename, Bool_t confirm) { //Delete repository file [datasetdir]/[datatypedir]/[filename] // //By default (confirm=kTRUE) we ask for confirmation before deleting. //Set confirm=kFALSE to delete without confirmation (DANGER!!!) TString path, tmp; AssignAndDelete(path, gSystem->ConcatFileName(fAccessroot.Data(), ds->GetDataPathSubdir())); AssignAndDelete(tmp, gSystem->ConcatFileName(path.Data(), ds->GetDataTypeSubdir(datatype))); AssignAndDelete(path, gSystem->ConcatFileName(tmp.Data(), filename)); TString cmd; cout << "Deleting file from repository: " << filename << endl; if (confirm) { cout << "Are you sure you want to delete this file permanently ? (y/n)" << endl; TString answer; cin >> answer; answer.ToUpper(); if (!answer.BeginsWith("Y")) { cout << "File not deleted" << endl; return; } } fDMS->forcedelete(path.Data()); }
void KVINDRAOnlineDataAnalyser::HandleCommands(TString& ordre, TSocket* theSocket) { // Gestion des ordres // Returns kTRUE if command was understood & executed // Returns kFALSE if command unknown // // STOP will stop the analysis (calls EndRun() and EndAnalysis()) // CLEAR RAZ de tous les spectres // // DUMP=yes start dumping fired data parameters // DUMP=no stop dumping fired data parameters // // SAVE=toto.root will save all histograms in '${ANALYSIS_RESULTS}/toto.root' (does not stop analysis) // SAVE=/home/toto.root will save all histograms in '/home/toto.root' (does not stop analysis) // SAVE will save all histograms in '${ANALYSIS_RESULTS}/[class name]_Run[run number]_[date].root' (does not stop analysis) KVString com(ordre.Data()); com.Begin("="); ordre = com.Next(); ordre.ToUpper(); if (ordre == "STOP") { // arrete l'analyse, en appelant EndRun() et EndAnalysis() fGoEventLoop = kFALSE; theSocket->Send("ok"); return; } else if (ordre == "SAVE") { TString tmp_fil = com.Next(); TString fil; bool send_name = kFALSE; if (tmp_fil.Contains("/")) fil = tmp_fil; else if (tmp_fil == "") { TDatime save_time; save_time.Set(); TString date = save_time.AsString(); date.ReplaceAll(" ", "_"); fil = Form("${ANALYSIS_RESULTS}/%s_Run%d_%s.root", GetName(), GetRunNumber(), date.Data()); send_name = kTRUE; } else fil = Form("${ANALYSIS_RESULTS}/%s", tmp_fil.Data()); SaveSpectra(fil.Data()); if (send_name) theSocket->Send(fil.Data()); else theSocket->Send("ok"); return; } else if (ordre == "CLEAR") { ClearAllHistos(); theSocket->Send("ok"); return; } else if (ordre == "DUMP") { TString tmp_fil = com.Next(); tmp_fil.ToLower(); if (tmp_fil == "yes")fDumpEvents = kTRUE; else if (tmp_fil == "no")fDumpEvents = kFALSE; else { theSocket->Send("unknown command"); return; } theSocket->Send("ok"); return; } theSocket->Send("unknown command"); }
void UATAna(TString Cfg = "Config.cfg" , TString Steps = "R"){ Steps.ToUpper(); UATAnaConfig Config; Config.ReadCfg(Cfg); Config.Print(); if ( Steps.Contains ('R') || Steps.Contains ('T') ) { bool bWTree = false ; if ( Steps.Contains ('T') ) bWTree = true ; UATAnaReader Reader; Reader.Init (Config , bWTree ); Reader.Analyze(Config , bWTree ); Reader.End (Config , bWTree ); } if ( Steps.Contains ('F') || Steps.Contains ('Y') || Steps.Contains ('L') || Steps.Contains ('C') ) { UATAnaDisplay Display; Display.Init (Config); if ( Steps.Contains ('D') ) { Config.SetDrawRatio(true); Config.SetDrawBgError(true); } if ( Steps.Contains ('E') ) Config.SetDrawBgError(true); if ( Steps.Contains ('F') ) Display.Yields(Config,1); if ( Steps.Contains ('Y') ) Display.Yields(Config,0,0); if ( Steps.Contains ('C') ) { if ( Steps.Contains ('S') ) Display.CPlot (Config,1); else Display.CPlot (Config,0); } if ( Steps.Contains ('L') ) Display.LimitCard (Config); } }
void KVGANILDataReader::SetUserTree(TTree* T, Option_t* opt) { // To fill a TTree with the data in the current file, create a TTree: // TFile* file = new TFile("run1.root","recreate"); // TTree* T = new TTree("Run1", "Raw data for Run1"); // and then call this method: SetUserTree(T) // If you read all events of the file, the TTree will be automatically filled // with data : // while( runfile->GetNextEvent() ) ; // // Two different TTree structures are available, depending on the option string: // // opt = "arrays": [default] // // The TTree will have the following structure: // // *Br 0 :NbParFired : NbParFired/I = number of fired parameters in event // *............................................................................* // *Br 1 :ParNum : ParNum[NbParFired]/i = array of indices of fired parameters // *............................................................................* // *Br 2 :ParVal : ParVal[NbParFired]/s = array of values of fired parameters // // This structure is the fastest to fill and produces the smallest file sizes. // In order to be able to directly access the parameters as if option "leaves" were used // (i.e. one branch/leaf for each parameter), we add two aliases for each parameter to // the tree: // PARNAME = value of parameter if present in event // PARNAME_M = number of times parameter appears in event // Assuming that each parameter only appears at most once in each event, i.e. PARNAME_M=0 or 1, // then // root[0] T->Draw("PARNAME", "PARNAME_M") // will histogram the value of PARNAME for each event in which it is present. // (if the selection condition "PARNAME_M" is not used, the histogram will also be filled with a 0 // for each event in which PARNAME does not appear). // N.B. the PARNAME alias is in fact the sum of the values of PARNAME in each event. // If PARNAME_M>1 in some events, it is not the individual values but their sum which will // be histogrammed in this case. // // Thus, if the data file has parameters called "PAR_1" and "PAR_2", // the following command will work // // root[0] T->Draw("PAR_1:PAR_2", "PAR_1_M&&PAR_2_M", "col") // // even though no branches "PAR_1" or "PAR_2" exist. // // // // opt = "leaves": // // The TTree will have a branch/leaf for each parameter. This option is slower and produces // larger files. // // If the option string contains both "arrays" and "leaves", then both structures will be used // (in this case there is a high redundancy, as each parameter is stored twice). // // The full list of parameters is stored in a TObjArray in the list returned by TTree::GetUserInfo(). // Each parameter is represented by a TNamed object. // In order to retrieve the name of the parameter with index 674 (e.g. taken from branch ParNum), // do: // TObjArray* parlist = (TObjArray*) T->GetUserInfo()->FindObject("ParameterList"); // cout << "Par 674 name = " << (*parlist)[674]->GetName() << endl; // // // Automatic creation & filling of Scalers TTree // // give an option string containing "scalers", i.e. "leaves,scalers", or "ARRAYS+SCALERS", etc. // a TTree with name 'Scalers' will be created, all scaler buffers will be written in it. TString option = opt; option.ToUpper(); make_arrays = option.Contains("ARRAYS"); make_leaves = option.Contains("LEAVES"); Bool_t make_scalers = option.Contains("SCALERS"); if(make_scalers){ fGanilData->SetScalerBuffersManagement(GTGanilData::kAutoWriteScaler); } fUserTree = T; if( make_arrays ){ Int_t maxParFired = GetRawDataParameters()->GetEntries(); ParVal = new UShort_t[maxParFired]; ParNum = new UInt_t[maxParFired]; fUserTree->Branch("NbParFired", &NbParFired, "NbParFired/I"); fUserTree->Branch("ParNum", ParNum, "ParNum[NbParFired]/i"); fUserTree->Branch("ParVal", ParVal, "ParVal[NbParFired]/s"); } if( make_leaves ){ TIter next_rawpar( GetRawDataParameters() ); KVACQParam* acqpar; while( (acqpar = (KVACQParam*)next_rawpar()) ){ TString leaf; leaf.Form("%s/S", acqpar->GetName()); // for parameters with <=8 bits only use 1 byte for storage if(acqpar->GetNbBits()<=8) leaf += "1"; fUserTree->Branch( acqpar->GetName(), *(acqpar->ConnectData()), leaf.Data() ); } } #if ROOT_VERSION_CODE > ROOT_VERSION(5,25,4) #if ROOT_VERSION_CODE < ROOT_VERSION(5,26,1) // The TTree::OptimizeBaskets mechanism is disabled, as for ROOT versions < 5.26/00b // this lead to a memory leak fUserTree->SetAutoFlush(0); #endif #endif // add list of parameter names in fUserTree->GetUserInfos() // and if option="arrays" add aliases for each parameter & its multiplicity // TObjArray has to be as big as the largest parameter number in the list // of raw data parameters. So first loop over parameters to find max param number. UInt_t maxpar = 0; TIter next(GetRawDataParameters()); KVACQParam* par; while( (par=(KVACQParam*)next()) ) if (par->GetNumber()>maxpar) maxpar=par->GetNumber(); TObjArray *parlist = new TObjArray(maxpar,1); parlist->SetName("ParameterList"); next.Reset(); while( (par = (KVACQParam*)next()) ){ parlist->AddAt( new TNamed( par->GetName(), Form("index=%d",par->GetNumber()) ), par->GetNumber() ); if( make_arrays ){ fUserTree->SetAlias( par->GetName(), Form("Sum$((ParNum==%d)*ParVal)", par->GetNumber() ) ); fUserTree->SetAlias( Form("%s_M", par->GetName()), Form("Sum$(ParNum==%d)", par->GetNumber() ) ); } } fUserTree->GetUserInfo()->Add(parlist); }
/** * Create our task, and return it. This uses the interpreter to * make the object. * * @param mgr Analysis manager * * @return Pointer to the task */ AliAnalysisTaskSE* CreateTask(AliAnalysisManager* mgr) { // Enable these lines to load the code from PWGUD directory. // These do not seem to be up-to-speed with the latest // developments, so for now, we use private scripts - sigh! // // Note, PWGLF also has these scripts, but it is not clear that // they are anymore current than the ones in PWGUD. // // gROOT->SetMacroPath(Form("%s:$ALICE_PHYSICS/PWGUD/multVScentPbPb", // gROOT->GetMacroPath())); // gSystem->AddIncludePath("-I$ALICE_PHYSICS/PWGUD/multVScentPbPb"); Info("CreateTasks", "Loading code"); fRailway->LoadSource("FixPaths.C"); fRailway->LoadSource("AliTrackletdNdetaUtils.C"); fRailway->LoadSource("AliTrackletdNdetaTask.C"); // --- Create the task using interpreter ------------------------- Bool_t mc = mgr->GetMCtruthEventHandler() != 0; const char* nme = (mc ? "MidMCdNdeta" : "MiddNdeta"); const char* cls = (mc ? "AliTrackletdNdetaMCTask" : "AliTrackletdNdetaTask"); Long_t ret = gROOT->ProcessLine(Form("new %s(\"%s\")",cls,nme)); AliAnalysisTaskSE* task =reinterpret_cast<AliAnalysisTaskSE*>(ret); if (!task) return 0; // --- Add task to train ----------------------------------------- gROOT->ProcessLine(Form("((%s*)%p)->Connect()", cls, task)); // --- Figure out the trigger options ---------------------------- TString trg = fOptions.Get("trig"); trg.ToUpper(); UInt_t sel = AliVEvent::kINT7; if (trg.EqualTo("MB")) sel = AliVEvent::kMB; else if (trg.EqualTo("V0AND")) sel = AliVEvent::kINT7; else if (trg.EqualTo("V0OR")) sel = AliVEvent::kCINT5; else if (trg.EqualTo("ANY")) sel = AliVEvent::kAny; // --- Set various options on task ------------------------------- const char* defCent = "0-5-10-20-30-40-50-60-70-80-90"; task->SelectCollisionCandidates(sel); FromOption(task, "ReconstructionMode", "reconstruct", "nor,inj"); FromOption(task, "CentralityMethod", "cent", "V0M"); FromOption(task, "CentralityAxis", "cent-bins", defCent); FromOption(task, "EtaAxis", "eta-bins", "r16:2"); FromOption(task, "IPzAxis", "ipz-bins", "u15"); // FromOption(task, "CheckReconstructables", "check-reco", false); FromOption(task, "MaxDelta", "max-delta", 25.); FromOption(task, "TailDelta", "tail-delta", 5.); FromOption(task, "ScaleDTheta", "scale-dtheta", false); FromOption(task, "DPhiWindow", "dphi-window", 0.06); FromOption(task, "DThetaWindow", "dtheta-window", 0.025); FromOption(task, "DPhiShift", "dphi-shift", 0.0045); FromOption(task, "PhiOverlapCut", "phi-overlap-cut" ,0.005); FromOption(task, "ZEtaOverlapCut", "z-eta-overlap-cut",0.05); FromOption(task, "PhiRotation", "phi-rotation", TMath::Pi()); // FromOption(task, "InjScale", "inj-scale", 1.); FromOption(task, "ShiftedDPhiCut", "shifted-dphi-cut",-1.); FromOption(task, "DeltaCut", "delta-cut", 1.5); if (fOptions.AsBool("cut-dtheta")) FromOption(task, "ScaleDThetaCut", "dtheta-window", 0.025); SetupReweighting(task); task->Print(""); return task; }
// all comparisons done with upper case (mostly because of Open MVS void TestRunner::run (int ac, const char **av) { TString testCase; if (ac == 1) { usage(av[0]); return; } // if for (int i = 1; i < ac; ++i) { testCase = av [i]; testCase.ToUpper(); if ( testCase == "-H" ) { usage(av[0]); return; } else if ( testCase == "-ALL" ) { runAllTests(); continue; } else if (testCase == "-LOG") { if (i < ac - 1) { setLogToFileNamed(av[++i]); } // if continue; } else if (testCase == "-OUT") { if (i < ac - 1) { ++i; int outfile = open(av[i], O_RDWR | O_CREAT | O_TRUNC, 0660); if (outfile > 0) { // make it stdout std::cout << "redirecting output to " << av[i] << std::endl; close(1); dup(outfile); // ignore possible errors for now close(outfile); } else { std::cout << "output redirection failed" << std::endl; } // if } // if continue; } else if (testCase == "-ERR") { if (i < ac - 1) { ++i; int outfile = open(av[i], O_RDWR | O_CREAT | O_TRUNC, 0660); if (outfile > 0) { // make it stdout std::cerr << "redirecting errors to " << av[i] << std::endl; close(2); dup(outfile); // ignore possible errors for now close(outfile); } else { std::cerr << "error redirection failed" << std::endl; } // if } // if continue; } else if (testCase == "-LIST") { listTests(); continue; } else if (testCase == "-WAIT") { fWait = true; continue; } // if Test *test; for ( test = fMappings->first(); test != 0 ; test = fMappings->next() ) { TString className = test->getClassName(); className.ToUpper(); if ( className == testCase ) { run(test->getSuite()); break; } // if } // for if ( !test ) { std::cout << "Test " << testCase << " not found." << std::endl; return; } } }
/// Add a AliAnalysisTaskEmcalJetCDFUE task - detailed signature /// \param const char *ntracks /// \param const char *nclusters /// \param const char *njets /// \param const char *nrho /// \param Double_t jetradius /// \param Double_t jetptcut /// \param Double_t jetareacut /// \param const char *type ; either TPC, EMCAL or USER /// \param Int_t leadhadtype ; 0 = charged, 1 = neutral, 2 = both /// \param const char *taskname /// \return AliAnalysisTaskEmcalJetCDFUE* task AliAnalysisTaskEmcalJetCDFUE *AddTaskEmcalJetCDFUE ( const char *ntracks = "Tracks", const char *nclusters = "CaloClusters", const char *njets = "Jets", const char *nrho = "", Double_t jetradius = 0.2, Double_t jetptcut = 1., Double_t jetptcutmax = 250., Double_t jetareacut = 0.001, const char *type = "TPC", // EMCAL, TPC Int_t leadhadtype = 0, // AliJetContainer :: Int_t fLeadingHadronType; 0 = charged, 1 = neutral, 2 = both const char *taskname = "JetCDF" // Int_t nCentBins = 1, ) { // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if ( !mgr ) { ::Error ( "AddTaskEmcalJetCDF", "No analysis manager to connect to." ); return NULL; } // Check the analysis type using the event handlers connected to the analysis manager. //============================================================================== if ( !mgr->GetInputEventHandler() ) { ::Error ( "AddTaskEmcalJetCDF", "This task requires an input event handler" ); return NULL; } //------------------------------------------------------- // Init the task and do settings //------------------------------------------------------- TString name ( taskname ); TString tracks ( ntracks ); TString clusters ( nclusters ); TString jets ( njets ); TString rho ( nrho ); TString acctype = type; acctype.ToUpper(); if ( acctype.Contains ("TPC") ) { acctype = "TPC"; } if ( acctype.Contains ("EMCAL") ) { acctype = "EMCAL"; } if ( acctype.Contains ("USER") ) { acctype = "USER"; } if ( jetptcut < 1. ) { jetptcut = 1.; } TString jetstr = "jpt"; jetstr += ( ULong_t ) ( jetptcut * 1000 ); if ( !jets.IsNull() ) { name += "_" + jets + "_" + jetstr; } if ( !rho.IsNull() ) { name += "_" + rho; } if ( !acctype.IsNull() ) { name += "_" + acctype; } AliAnalysisTaskEmcalJetCDFUE *jetTask = new AliAnalysisTaskEmcalJetCDFUE ( name ); jetTask->SetCentRange ( 0., 100. ); jetTask->SetNCentBins ( 1 ); AliParticleContainer *trackCont = jetTask->AddParticleContainer ( ntracks ); trackCont->SetClassName ( "AliVTrack" ); AliClusterContainer *clusterCont = jetTask->AddClusterContainer ( nclusters ); // clusterCont->SetClassName("AliVCluster"); AliJetContainer *jetCont = jetTask->AddJetContainer ( njets, acctype, jetradius ); if ( jetCont ) { if ( !rho.IsNull() ) { jetCont->SetRhoName ( nrho ); } jetCont->ConnectParticleContainer ( trackCont ); jetCont->ConnectClusterContainer ( clusterCont ); jetCont->SetPercAreaCut ( jetareacut ); jetCont->SetJetPtCut ( jetptcut ); jetCont->SetJetPtCutMax ( jetptcutmax ); jetCont->SetLeadingHadronType ( leadhadtype ); // Int_t fLeadingHadronType; 0 = charged, 1 = neutral, 2 = both jetCont->SetZLeadingCut ( 0., 1. ); } //------------------------------------------------------- // Final settings, pass to manager and set the containers //------------------------------------------------------- mgr->AddTask ( jetTask ); TString contname = name + "_histos"; TString outfile = AliAnalysisManager::GetCommonFileName(); // Create containers for input/output AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; AliAnalysisDataContainer *coutput1 = mgr->CreateContainer ( contname.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data() ); mgr->ConnectInput ( jetTask, 0, cinput1 ); mgr->ConnectOutput ( jetTask, 1, coutput1 ); return jetTask; }
/** * Create our tasks. This uses the interpreter to make the object. * * @param mgr */ void CoupleTrackletCar(AliAnalysisManager* mgr) { AliAnalysisManager::SetCommonFileName("tracklet_dndeta.root"); TString fwd(gSystem->Getenv("ANA_SRC")); if (fwd.IsNull()) fwd = "$ALICE_PHYSICS/PWGLF/FORWARD/analysis2"; gROOT->SetMacroPath(Form("%s:%s/dndeta/tracklets3", gROOT->GetMacroPath(), fwd.Data())); gSystem->AddIncludePath(Form("-I%s/dndeta/tracklets3", fwd.Data())); Info("CreateTasks", "Loading code"); fRailway->LoadSource("FixPaths.C"); fRailway->LoadSource("AliAODSimpleHeader.C"); fRailway->LoadSource("AliAODTracklet.C"); fRailway->LoadSource("AliTrackletWeights.C"); fRailway->LoadSource("AliTrackletAODUtils.C"); fRailway->LoadSource("AliTrackletAODdNdeta.C"); // --- Create the task using interpreter ------------------------- Bool_t mc = fOptions.Has("mc"); if (!mc) mc = fRailway->IsMC(); Long_t ret = gROOT->ProcessLine(Form("AliTrackletAODdNdeta::Create(%d,\"%s\")",mc, fOptions.AsString("reweigh"))); AliAnalysisTaskSE* task = reinterpret_cast<AliAnalysisTaskSE*>(ret); if (!task) return; // --- Figure out the trigger options ---------------------------- TString trg = fOptions.Get("trig"); trg.ToUpper(); UInt_t sel = AliVEvent::kINT7; UInt_t mb = AliVEvent::kINT1; // AliVEvent::kMB; if (trg.EqualTo("MB")) sel = mb; else if (trg.EqualTo("MBOR")) sel = mb; else if (trg.EqualTo("INEL")) sel = mb; else if (trg.EqualTo("INELGT0")) sel = mb; else if (trg.EqualTo("V0AND")) sel = AliVEvent::kINT7; else if (trg.EqualTo("NSD")) sel = AliVEvent::kINT7; else if (trg.EqualTo("V0OR")) sel = AliVEvent::kCINT5; else if (trg.EqualTo("ANY")) sel = AliVEvent::kAny; task->SelectCollisionCandidates(sel); Int_t minTrk = trg.EqualTo("INELGT0") ? 1 : 0; // --- Figure out calculation mode ------------------------------- TString calc = fOptions.Get("reweigh-calc"); calc.ToUpper(); UChar_t mcal = 0; if (calc.BeginsWith("PROD")) mcal = 0; else if (calc.BeginsWith("SQ")) mcal = 1; else if (calc.BeginsWith("SUM")) mcal = 2; else if (calc.BeginsWith("AV")) mcal = 3; // --- Set various options on task ------------------------------- const char* defCent = "0-5-10-20-30-40-50-60-70-80-90"; FromOption(task, "CentralityMethod","cent", "V0M"); FromOption(task, "CentralityAxis", "cent-bins", defCent); FromOption(task, "EtaAxis", "eta-bins", "r16:2"); FromOption(task, "IPzAxis", "ipz-bins", "u15"); FromOption(task, "DeltaCut", "delta-cut", 1.5); FromOption(task, "TailDelta", "tail-delta", 5.); FromOption(task, "TailMaximum", "tail-max", -1); FromOption(task, "MaxDelta", "max-delta", 25.); FromOption(task, "DPhiShift", "dphi-shift", 0.0045); FromOption(task, "ShiftedDPhiCut", "shifted-dphi-cut",-1.); FromOption(task, "AbsMinCent", "abs-min-cent", -1.); FromOption(task, "WeightMask", "reweigh-mask", 0xFF); FromOption(task, "WeightVeto", "reweigh-veto", 0x0); SetOnTask (task, "WeightCalc", mcal); FromOption(task, "WeightInverse", "reweigh-inv", false); FromOption(task, "TriggerEff", "trigEff", 0.); SetOnTask (task, "MinEta1", minTrk); // if (mc && we) { // TUrl wurl(fOptions.AsString("reweight")); // TFile* wfile = TFile::Open(wurl.GetFile()); // if (!wfile) { // Warning("CreateTasks", "Failed to open weights file: %s", // wurl.GetUrl()); // return; // } // TString wnam(wurl.GetAnchor()); // if (wnam.IsNull()) wnam = "weights"; // TObject* wobj = wfile->Get(wnam); // if (!wobj) { // Warning("CreateTasks", "Failed to get weights %s from file %s", // wnam.Data(), wfile->GetName()); // return; // } // if (!wobj->IsA()->InheritsFrom("AliTrackletWeights")) { // Warning("CreateTasks", "Object %s from file %s not an " // "AliTrackletWeights but a %s", // wnam.Data(), wfile->GetName(), wobj->ClassName()); // return; // } // SetOnTaskGeneric(task, "Weights", // Form("((AliTrackletWeights*)%p)", wobj)); // } Printf("Print the generated task"); task->Print(""); }