//_________________________________________________________________________________________________ void GroupByChamber(AliMergeableCollection& hc, int timeResolution) { for ( Int_t ich = 1; ich <= 10; ++ich ) { AliMpDEIterator it; it.First(ich-1); TH1* hchamberLeft(0x0); TH1* hchamberRight(0x0); TList listLeft; TList listRight; listLeft.SetOwner(kFALSE); listRight.SetOwner(kFALSE); AliMpDCSNamer dcs("TRACKER"); while (!it.IsDone()) { Int_t detElemId = it.CurrentDEId(); AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); TH1* h = hc.Histo(Form("/DE/HITS/%ds/DE%04d",timeResolution,detElemId)); if (dcs.DCSAliasName(detElemId).Contains("Left")) { if (!hchamberLeft) { hchamberLeft = static_cast<TH1*>(h->Clone(Form("CHAMBER%dLEFT",ich))); } else { listLeft.Add(h); } } else { if (!hchamberRight) { hchamberRight = static_cast<TH1*>(h->Clone(Form("CHAMBER%dRIGHT",ich))); } else { listRight.Add(h); } } it.Next(); } hchamberLeft->Merge(&listLeft); hchamberRight->Merge(&listRight); hc.Adopt(Form("/CHAMBER/HITS/%ds",timeResolution),hchamberLeft); hc.Adopt(Form("/CHAMBER/HITS/%ds",timeResolution),hchamberRight); TH1* hchamber = static_cast<TH1*>(hchamberLeft->Clone(Form("CHAMBER%d",ich))); hchamber->Add(hchamberRight); hc.Adopt(Form("/CHAMBER/HITS/%ds",timeResolution),hchamber); } }
/** * End of job processing */ void Terminate(Option_t*) { fList = dynamic_cast<TList*>(GetOutputData(1)); if (!fList) { AliError(Form("No output list defined (%p)", GetOutputData(1))); if (GetOutputData(1)) GetOutputData(1)->Print(); return; } TList* output = new TList; output->SetName("triggerResults"); output->SetOwner(); fVertexMC = static_cast<TH1D*>(fList->FindObject("vertexMC")); fVertexESD = static_cast<TH1D*>(fList->FindObject("vertexESD")); fM = static_cast<TH1D*>(fList->FindObject("m")); if (fVertexMC) { TH1D* vtxMC = static_cast<TH1D*>(fVertexMC->Clone("vertexMC")); vtxMC->SetDirectory(0); if (vtxMC->GetEntries() > 0) vtxMC->Scale(1. / vtxMC->GetEntries()); else vtxMC->Scale(0); output->Add(vtxMC); } if (fVertexESD) { TH1D* vtxESD = static_cast<TH1D*>(fVertexESD->Clone("vertexESD")); vtxESD->SetDirectory(0); if (vtxESD->GetEntries() > 0) vtxESD->Scale(1. / vtxESD->GetEntries()); else vtxESD->Scale(0); output->Add(vtxESD); } if (fM) { TH1D* m = static_cast<TH1D*>(fM->Clone("m")); m->SetDirectory(0); m->SetYTitle("P(N_{ch}|_{|#eta|<1} < X)"); if (m->GetBinContent(1) > 0) m->Scale(1. / m->GetBinContent(1)); else m->Scale(0); output->Add(m); } TString vtxReq; if (fVertexRequirement & kMC) vtxReq.Append("MC "); if (fVertexRequirement & kESD) vtxReq.Append("ESD "); output->Add(new TNamed("vtxReq", vtxReq.Data())); output->Add(new TNamed("trkReq", fTrackletRequirement == kMC ? "MC" : "ESD")); fInel.Finish(fList, output); fInelGt0.Finish(fList, output); fNSD.Finish(fList, output); fNClusterGt0.Finish(fList, output); PostData(2, output); }
//_________________________________________________________________________________________________ void GroupByDDL(AliMergeableCollection& hc, int timeResolution) { Int_t nddls = AliDAQ::NumberOfDdls("MUONTRK"); Int_t offset = AliDAQ::DdlIDOffset("MUONTRK"); for ( Int_t i = 0; i < nddls; ++i ) { Int_t ddlId = offset + i; AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(i); TH1* hddl(0x0); TList list; list.SetOwner(kFALSE); for ( Int_t ide = 0; ide < ddl->GetNofDEs(); ++ide ) { Int_t detElemId = ddl->GetDEId(ide); TH1* h = hc.Histo(Form("/DE/HITS/%ds/DE%04d",timeResolution,detElemId)); if (!hddl) { hddl = static_cast<TH1*>(h->Clone(Form("DDL%d",ddlId))); } else { list.Add(h); } } hddl->Merge(&list); hc.Adopt(Form("/DDL/HITS/%ds",timeResolution),hddl); } }
void monsim(Int_t nev=20){ // Geant3 and Pythia gSystem->Load("liblhapdf"); gSystem->Load("libEGPythia6"); gSystem->Load("libpythia6"); gSystem->Load("libAliPythia6"); gSystem->Load("libgeant321"); // MonaLisa monitoring gSystem->Load("libNet.so"); gSystem->Load("libMonaLisa.so"); new TMonaLisaWriter("aliendb3.cern.ch", "Simulation pp", gSystem->Getenv("TEST_PLATFORMID"), gSystem->Getenv("TEST_PLATFORMID"), "global"); gROOT->LoadMacro("sim.C"); sim(nev); if (gMonitoringWriter) gMonitoringWriter->SendProcessingProgress(1,1,kTRUE); // Send the size of the raw.root file FileStat_t buf; gSystem->GetPathInfo("./raw.root",buf); TList *valuelist = new TList(); valuelist->SetOwner(kTRUE); TMonaLisaValue* valdouble = new TMonaLisaValue("raw.root size",buf.fSize); valuelist->Add(valdouble); if (gMonitoringWriter) gMonitoringWriter->SendParameters(valuelist); delete valuelist; printf("#Test finished successfully#\n"); }
void KVList::Streamer(TBuffer &R__b) { // Backwards-compatible streamer UInt_t R__s, R__c; if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v < 3) { // read in old KVList object which inherited from TList TList list; list.Streamer(R__b); TQObjSender fQObj; fQObj.Streamer(R__b); SetOwner(list.IsOwner()); // was list owner of objects ? list.SetOwner(kFALSE); // make sure old list doesn't delete objects when it goes out of scope TIter next(&list); TObject* obj; while ( (obj = next()) ) Add(obj); list.Clear(); } else R__b.ReadClassBuffer(KVList::Class(),this,R__v,R__s,R__c); } else { R__b.WriteClassBuffer(KVList::Class(),this); } }
UInt_t GetListOfTitles( TDirectory *rfdir, TList & titles ) { // get a list of titles (i.e TDirectory) given a method dir UInt_t ni=0; if (rfdir==0) return 0; TList *keys = rfdir->GetListOfKeys(); if (keys==0) { cout << "+++ Directory '" << rfdir->GetName() << "' contains no keys" << endl; return 0; } // TIter rfnext(rfdir->GetListOfKeys()); TKey *rfkey; titles.Clear(); titles.SetOwner(kFALSE); while ((rfkey = (TKey*)rfnext())) { // make sure, that we only look at histograms TClass *cl = gROOT->GetClass(rfkey->GetClassName()); if (cl->InheritsFrom("TDirectory")) { titles.Add(rfkey); ni++; } } cout << "--- Found " << ni << " instance(s) of the method " << rfdir->GetName() << endl; return ni; }
template <class HolderClass> bool read(const char *testname, int nEntry = 0, bool readother = false) { // for each dirname TString dirname = gROOT->GetVersion(); dirname.ReplaceAll(".","-"); dirname.ReplaceAll("/","-"); bool result = true; result &= read<HolderClass>(dirname,testname, nEntry, /*current=*/true); if (readother) { TList listOfDirs; listOfDirs.SetOwner(kTRUE); fillListOfDir(listOfDirs); TIter next(&listOfDirs); while (TObjString *dir = (TObjString*)next()) { if (dirname != dir->GetName()) { std::cout << "Testing older file format from: " << dir->GetName() << std::endl; result &= read<HolderClass>(dir->GetName(),testname, nEntry, /*current=*/ false); } } } return result; }
TList* KVDMS::GetListing(const Char_t* directory) { // Create and fill TList with just the names of files & containers in current directory // (default) or in given directory. // TList is filled with DMSFile_t objects which belong to the list, list must be deleted after use. list(directory); if (fout == "") { Error("GetListing", "Unknown directory %s", directory); return 0; } TObjArray* toks = fout.Tokenize("\n"); TList* list = new TList; list->SetOwner(kTRUE); list->SetName(((TObjString*)(*toks)[0])->String().Remove(TString::kBoth, ' ').Data()); for (int i = 1; i < toks->GetEntries(); i++) { TString tmp = ((TObjString*)(*toks)[i])->String().Remove(TString::kBoth, ' '); DMSFile_t* f = new DMSFile_t; if (IsContainer(tmp)) { // container f->SetName(gSystem->BaseName(tmp.Data())); f->SetIsContainer(); } else { f->SetName(tmp.Data()); } list->Add(f); } delete toks; return list; }
void monrec() { // MonaLisa monitoring gSystem->Load("libNet.so"); gSystem->Load("libMonaLisa.so"); new TMonaLisaWriter("aliendb3.cern.ch", "Reconstruction PbPb", gSystem->Getenv("TEST_PLATFORMID"), gSystem->Getenv("TEST_PLATFORMID"), "global"); gROOT->LoadMacro("rec.C"); rec(); if (gMonitoringWriter) gMonitoringWriter->SendProcessingProgress(1,1,kTRUE); // Send the size of the IlcESDs.root file FileStat_t buf; gSystem->GetPathInfo("./IlcESDs.root",buf); TList *valuelist = new TList(); valuelist->SetOwner(kTRUE); TMonaLisaValue* valdouble = new TMonaLisaValue("IlcESDs.root size",buf.fSize); valuelist->Add(valdouble); if (gMonitoringWriter) gMonitoringWriter->SendParameters(valuelist); delete valuelist; printf("#Test finished successfully#\n"); }
//______________________________________________________________________________ AliAnalysisTask* runMuMuLoop(TString smode = "local", TString inputFileName = "Find;BasePath=/alice/data/2015/LHC15o/000244918/muon_calo_pass1/AOD/*;FileName=AliAOD.Muons.root;Mode=cache;" ) { // path for macro usefull for saf3 gROOT->LoadMacro(gSystem->ExpandPathName("$HOME/Documents/Analysis/Macro/Philippe/runTaskFacilities.C")); // --- analysis setup --- TString rootVersion = ""; TString alirootVersion = ""; TString aliphysicsVersion = "vAN-20151215-1"; TString dataDir = "/alice/cern.ch/user/p/ppillot/Data/LHC15n/reco/PbPbParam_AlignV6"; TString dataPattern = "*AliESDs.root"; TString runFormat = "%09d"; TString outDir = "Data/LHC15n/reco/PbPbParam_AlignV6/Phys/all"; TString analysisMacroName = "Physics"; Int_t ttl = 30000; Int_t maxFilesPerJob = 100; Int_t maxMergeFiles = 10; Int_t maxMergeStages = 2; TString extraLibs="PWGmuon"; TString extraIncs="include"; TString extraTasks=""; TString extraPkgs=""; // Copy file to run on the saf TList pathList=0x0; pathList.SetOwner(); // pathList.Add(new TObjString("$HOME/alicesw/aliphysics/mumu/src/PWG/muon")); TList fileList; fileList.SetOwner(); // --- prepare the analysis environment --- Int_t mode = PrepareAnalysis(smode, inputFileName, extraLibs, extraIncs, extraTasks, extraPkgs, pathList, fileList); fileList.Add(new TObjString("runMuMuLoop.C")); fileList.Add(new TObjString("AddTaskMuMu.C")); // --- run the analysis (saf3 is a special case as the analysis is launched on the server) --- // --- run the analysis (saf3 is a special case as the analysis is launched on the server) --- if (mode == kSAF3Connect) { RunAnalysisOnSAF3(fileList, aliphysicsVersion, inputFileName); } else { CreateAnalysisTrain(); RunAnalysis(smode, inputFileName, rootVersion, alirootVersion, aliphysicsVersion, extraLibs, extraIncs, extraTasks, extraPkgs, dataDir, dataPattern, outDir, analysisMacroName, runFormat, ttl, maxFilesPerJob, maxMergeFiles, maxMergeStages); } }
//_________________________________________________________________________________________________ void GroupByDE(AliMergeableCollection& hc, int timeResolution) { AliMpDEIterator it; it.First(); while (!it.IsDone()) { Int_t detElemId = it.CurrentDEId(); AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); TList list; list.SetOwner(kFALSE); TH1* hde(0x0); if ( de->GetStationType() != AliMp::kStationTrigger) { for ( Int_t i = 0; i < de->GetNofBusPatches(); ++i ) { Int_t busPatchId = de->GetBusPatchId(i); TH1* h = hc.Histo(Form("/BUSPATCH/HITS/%ds/BP%04d",timeResolution,busPatchId)); if (!hde) { hde = static_cast<TH1*>(h->Clone()); hde->SetName(Form("DE%04d",detElemId)); } else { list.Add(h); } } hde->Merge(&list); hc.Adopt(Form("/DE/HITS/%ds",timeResolution),hde); } it.Next(); } }
//______________________________________________________________________________ void CreateAnalysisTrain() { /// create the analysis train and configure it // analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("MuonPhysicsAnalysis"); // Debug mode //mgr->SetDebugLevel(3); // AOD handler AliInputEventHandler* aodH = new AliAODInputHandler; mgr->SetInputEventHandler(aodH); // Fill the trigger list with desired trigger combinations (See on ALICE log book for denomination) //============================================================================== TList* triggers = new TList; // Create pointer for trigger list triggers->SetOwner(kTRUE); // Give rights to trigger liser if (!isMC) { // PbPb trigger triggers->Add(new TObjString("CINT7-B-NOPF-MUFAST"));//MB &0MUL triggers->Add(new TObjString("CINT7-B-NOPF-MUFAST&0MSL"));//MB &0MUL triggers->Add(new TObjString("CINT7-B-NOPF-MUFAST&0MUL"));//MB &0MUL triggers->Add(new TObjString("CMUL7-B-NOPF-MUFAST"));// MUL triggers->Add(new TObjString("CMSL7-B-NOPF-MUFAST"));// MSL triggers->Add(new TObjString("CMSL7-B-NOPF-MUFAST&0MUL"));// MSL &0MUL } // Load centrality task //============================================================================== gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C"); AddTaskMultSelection(kFALSE); // user // Load task //============================================================================== TString outputname = AliAnalysisManager::GetAnalysisManager()->GetCommonFileName(); // Create output name in case of no dataset selected gROOT->LoadMacro("AddTaskMuMu.C"); AddTaskMuMu(outputname.Data(),triggers,"PbPb2015",isMC); cout <<"add task mumu done"<< endl; }
UInt_t GetListOfKeys( TList& keys, TString inherits, TDirectory *dir=0 ) { // get a list of keys with a given inheritance // the list contains TKey objects if (dir==0) dir = gDirectory; TIter mnext(dir->GetListOfKeys()); TKey *mkey; keys.Clear(); keys.SetOwner(kFALSE); UInt_t ni=0; while ((mkey = (TKey*)mnext())) { // make sure, that we only look at TDirectory with name Method_<xxx> TClass *cl = gROOT->GetClass(mkey->GetClassName()); if (cl->InheritsFrom(inherits)) { keys.Add(mkey); ni++; } } return ni; }
void AdaptFileStructure(TString fileName) { TFile* f = TFile::Open(fileName.Data(), "READ"); TList* cList = new TList(); cList->SetName("cList"); cList->SetOwner(kTRUE); for (Int_t i = 0; i < gFile->GetNkeys(); i++) { TObject* obj = f->GetListOfKeys()->At(i); TString name = obj->GetName(); TObject* obj2 = f->Get(name.Data()); cList->Add(obj2); } TString fileNameOutput = fileName; fileNameOutput.ReplaceAll(".root", "_commonStructure.root"); TFile* fOut = TFile::Open(fileNameOutput.Data(), "RECREATE"); fOut->mkdir("PWGLF_PPVsMultXCheck_MC"); fOut->cd("PWGLF_PPVsMultXCheck_MC"); cList->Write("cList", TObject::kSingleKey); fOut->Close(); f->Close(); }
UInt_t GetListOfTitles( TString & methodName, TList & titles, TDirectory *dir=0 ) { // get the list of all titles for a given method // if the input dir is 0, gDirectory is used // returns a list of keys UInt_t ni=0; if (dir==0) dir = gDirectory; TDirectory* rfdir = (TDirectory*)dir->Get( methodName ); if (rfdir==0) { cout << "+++ Could not locate directory '" << methodName << endl; return 0; } return GetListOfTitles( rfdir, titles ); TList *keys = rfdir->GetListOfKeys(); if (keys==0) { cout << "+++ Directory '" << methodName << "' contains no keys" << endl; return 0; } // TIter rfnext(rfdir->GetListOfKeys()); TKey *rfkey; titles.Clear(); titles.SetOwner(kFALSE); while ((rfkey = (TKey*)rfnext())) { // make sure, that we only look at histograms TClass *cl = gROOT->GetClass(rfkey->GetClassName()); if (cl->InheritsFrom("TDirectory")) { titles.Add(rfkey); ni++; } } cout << "--- Found " << ni << " instance(s) of the method " << methodName << endl; return ni; }
UInt_t GetListOfMethods( TList & methods, TDirectory *dir=0 ) { // get a list of methods // the list contains TKey objects if (dir==0) dir = gDirectory; TIter mnext(dir->GetListOfKeys()); TKey *mkey; methods.Clear(); methods.SetOwner(kFALSE); UInt_t ni=0; while ((mkey = (TKey*)mnext())) { // make sure, that we only look at TDirectory with name Method_<xxx> TString name = mkey->GetClassName(); TClass *cl = gROOT->GetClass(name); if (cl->InheritsFrom("TDirectory")) { if (TString(mkey->GetName()).BeginsWith("Method_")) { methods.Add(mkey); ni++; } } } cout << "--- Found " << ni << " classifier types" << endl; return ni; }
void AddTask_GammaConvDalitzV1_pp( Int_t trainConfig = 1, //change different set of cuts Bool_t isMC = kFALSE, //run MC TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input Int_t enableMatBudWeightsPi0 = 0, // 1 = three radial bins, 2 = 10 radial bins TString filenameMatBudWeights = "MCInputFileMaterialBudgetWeights.root" ) { Int_t isHeavyIon = 0; // ================== GetAnalysisManager =============================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { Error(Form("AddTask_GammaConvDalitzV1_%i",trainConfig), "No analysis manager found."); return ; } // ================== GetInputEventHandler ============================= AliVEventHandler *inputHandler=mgr->GetInputEventHandler(); //========= Add PID Reponse to ANALYSIS manager ==== if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){ gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); AddTaskPIDResponse(isMC); } //========= Set Cutnumber for V0Reader ================================ //TString cutnumber = "00000000000840010015000000"; TString cutnumberPhoton = "06000008400100007500000000"; TString cutnumberEvent = "00000103"; AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); //========= Add V0 Reader to ANALYSIS manager if not yet existent ===== TString V0ReaderName = Form("V0ReaderV1_%s_%s",cutnumberEvent.Data(),cutnumberPhoton.Data()); if( !(AliV0ReaderV1*)mgr->GetTask(V0ReaderName.Data()) ){ AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1(V0ReaderName.Data()); fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE); fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output fV0ReaderV1->SetUseAODConversionPhoton(kTRUE); AliConvEventCuts *fEventCuts=NULL; if(cutnumberEvent!=""){ fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data()); fEventCuts->SetPreSelectionCutFlag(kTRUE); fEventCuts->SetV0ReaderName(V0ReaderName); if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){ fV0ReaderV1->SetEventCuts(fEventCuts); fEventCuts->SetFillCutHistograms("",kTRUE); } } // Set AnalysisCut Number AliConversionPhotonCuts *fCuts=NULL; if(cutnumberPhoton!=""){ fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data()); fCuts->SetPreSelectionCutFlag(kTRUE); fCuts->SetIsHeavyIon(isHeavyIon); fCuts->SetV0ReaderName(V0ReaderName); if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){ fV0ReaderV1->SetConversionCuts(fCuts); fCuts->SetFillCutHistograms("",kTRUE); } } if(inputHandler->IsA()==AliAODInputHandler::Class()){ // AOD mode fV0ReaderV1->AliV0ReaderV1::SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data())); } fV0ReaderV1->Init(); AliLog::SetGlobalLogLevel(AliLog::kInfo); //connect input V0Reader mgr->AddTask(fV0ReaderV1); mgr->ConnectInput(fV0ReaderV1,0,cinput); } if( !(AliDalitzElectronSelector*)mgr->GetTask("ElectronSelector") ){ AliDalitzElectronSelector *fElectronSelector = new AliDalitzElectronSelector("ElectronSelector"); //ConfigV0ReaderV1(fV0ReaderV1,ConvCutnumber,IsHeavyIon); // Set AnalysisCut Number AliDalitzElectronCuts *fElecCuts=0; TString ElecCuts = "30105400000003300000"; if( ElecCuts!=""){ fElecCuts= new AliDalitzElectronCuts(ElecCuts.Data(),ElecCuts.Data()); if(fElecCuts->InitializeCutsFromCutString(ElecCuts.Data())){ fElectronSelector->SetDalitzElectronCuts(fElecCuts); fElecCuts->SetFillCutHistograms("",kTRUE); } } fElectronSelector->Init(); mgr->AddTask(fElectronSelector); //connect input fElectronSelector mgr->ConnectInput (fElectronSelector,0,cinput); } //================================================ //========= Add task to the ANALYSIS manager ===== // find input container AliAnalysisTaskGammaConvDalitzV1 *task=NULL; task= new AliAnalysisTaskGammaConvDalitzV1(Form("GammaConvDalitzV1_%i",trainConfig)); task->SetIsHeavyIon(0); task->SetIsMC(isMC); task->SetV0ReaderName(V0ReaderName); CutHandlerConvDalitz cuts; if(trainConfig == 1){ cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253202221710"); // standard cut number for pp7TeV cuts.AddCut("00000113", "00200009360300007800004000", "0163103100900000", "20475400253202221710"); // train configs 2 to 4 for estimation of systematics of standard cut number pp7TeV } else if (trainConfig == 2) { cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "10475400253202221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "30475400253202221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253201221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253203221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253202121710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253202321710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253302221710"); } else if (trainConfig == 3) { cuts.AddCut("00000113", "00200009360300007900004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009360300007200004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009360300007100004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009360300001800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009360300002800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200049360300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200019360300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20475400253202222710"); } else if (trainConfig == 4) { cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20575400253202221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20775400253202221710"); cuts.AddCut("00000113", "00200009260300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009660300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20425400253202221710"); cuts.AddCut("00000113", "00200009360300007800004000", "0263103100900000", "20407200253202221710"); cuts.AddCut("00000113", "00200009320300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00000113", "00200009305100007800004000", "0263103100900000", "20475400253202221710"); } else if (trainConfig == 102) { cuts.AddCut("00010113", "00200009360300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00010113", "00200009360300007800004000", "0263103100900000", "10475400253202221710"); cuts.AddCut("00010113", "00200009360300007800004000", "0263103100900000", "30475400253202221710"); cuts.AddCut("00010113", "00200009360300007800004000", "0263103100900000", "20475400253201221710"); cuts.AddCut("00010113", "00200009360300007800004000", "0263103100900000", "20475400253203221710"); cuts.AddCut("00010113", "00200009360300007800004000", "0263103100900000", "20475400253202121710"); cuts.AddCut("00010113", "00200009360300007800004000", "0263103100900000", "20475400253202321710"); } else if (trainConfig == 103) { cuts.AddCut("00010113", "00200009266300008854404000", "0263103100900000", "20475400253202321710"); cuts.AddCut("00010113", "00200009266300008854404000", "0263103100900000", "20475400253202301710"); } else if (trainConfig == 104) { // to be used with MBW cuts.AddCut("00010113", "00200009266300008854404000", "0263103100900000", "20475400253202321710"); cuts.AddCut("00010113", "00200009266300008854404000", "0263103100900000", "20475400253202301710"); } else if (trainConfig == 202) { cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253202221710"); cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "10475400253202221710"); cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "30475400253202221710"); cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253201221710"); cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253203221710"); cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253202121710"); cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253202321710"); } else { Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration"); return; } if(!cuts.AreValid()){ cout << "\n\n****************************************************" << endl; cout << "ERROR: No valid cuts stored in CutHandlerConvDalitz! Returning..." << endl; cout << "****************************************************\n\n" << endl; return; } Int_t numberOfCuts = cuts.GetNCuts(); TList *EventCutList = new TList(); TList *ConvCutList = new TList(); TList *MesonCutList = new TList(); TList *ElecCutList = new TList(); TList *HeaderList = new TList(); TObjString *Header2 = new TObjString("BOX"); HeaderList->Add(Header2); EventCutList->SetOwner(kTRUE); AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts]; ConvCutList->SetOwner(kTRUE); AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts]; MesonCutList->SetOwner(kTRUE); AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts]; ElecCutList->SetOwner(kTRUE); AliDalitzElectronCuts **analysisElecCuts = new AliDalitzElectronCuts*[numberOfCuts]; Bool_t initializedMatBudWeigths_existing = kFALSE; for(Int_t i = 0; i<numberOfCuts; i++){ TString cutName( Form("%s_%s_%s_%s",(cuts.GetEventCut(i)).Data(),(cuts.GetPhotonCut(i)).Data(),(cuts.GetElecCut(i)).Data(),(cuts.GetMesonCut(i)).Data() ) ); analysisEventCuts[i] = new AliConvEventCuts(); analysisEventCuts[i]->SetV0ReaderName(V0ReaderName); analysisEventCuts[i]->InitializeCutsFromCutString((cuts.GetEventCut(i)).Data()); EventCutList->Add(analysisEventCuts[i]); analysisEventCuts[i]->SetFillCutHistograms("",kFALSE); analysisCuts[i] = new AliConversionPhotonCuts(); if (enableMatBudWeightsPi0 > 0){ if (isMC > 0){ if (analysisCuts[i]->InitializeMaterialBudgetWeights(enableMatBudWeightsPi0,filenameMatBudWeights)){ initializedMatBudWeigths_existing = kTRUE;} else {cout << "ERROR The initialization of the materialBudgetWeights did not work out." << endl;} } else {cout << "ERROR 'enableMatBudWeightsPi0'-flag was set > 0 even though this is not a MC task. It was automatically reset to 0." << endl;} } analysisCuts[i]->SetV0ReaderName(V0ReaderName); analysisCuts[i]->InitializeCutsFromCutString((cuts.GetPhotonCut(i)).Data()); ConvCutList->Add(analysisCuts[i]); analysisCuts[i]->SetFillCutHistograms("",kFALSE); analysisMesonCuts[i] = new AliConversionMesonCuts(); analysisMesonCuts[i]->InitializeCutsFromCutString((cuts.GetMesonCut(i)).Data()); MesonCutList->Add(analysisMesonCuts[i]); analysisMesonCuts[i]->SetFillCutHistograms(""); analysisElecCuts[i] = new AliDalitzElectronCuts(); analysisElecCuts[i]->InitializeCutsFromCutString((cuts.GetElecCut(i)).Data()); ElecCutList->Add(analysisElecCuts[i]); analysisElecCuts[i]->SetFillCutHistograms("",kFALSE,cutName); analysisEventCuts[i]->SetAcceptedHeader(HeaderList); } task->SetEventCutList(numberOfCuts,EventCutList); task->SetConversionCutList(numberOfCuts,ConvCutList); task->SetMesonCutList(MesonCutList); task->SetElectronCutList(ElecCutList); task->SetMoveParticleAccordingToVertex(kTRUE); if (initializedMatBudWeigths_existing) { task->SetDoMaterialBudgetWeightingOfGammasForTrueMesons(kTRUE); } //task->SetDoMesonAnalysis(kTRUE); //if (enableQAMesonTask) task->SetDoMesonQA(kTRUE); //Attention new switch for Pi0 QA //if (enableQAMesonTask) task->SetDoPhotonQA(kTRUE); //Attention new switch small for Photon QA //connect containers AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("GammaConvDalitzV1_%i",trainConfig), TList::Class(), AliAnalysisManager::kOutputContainer,Form("GammaConvDalitzV1_%i.root",trainConfig)); mgr->AddTask(task); mgr->ConnectInput(task,0,cinput); mgr->ConnectOutput(task,1,coutput); return; }
//______________________________________________________________________________ void MUONStatusMapEvolution(const char* runlist, const char* outfile) { // Compute the number of bad pads (because of bad ped, bad hv, bad lv, // or missing in configuration) // // output a root file with the different graphs. // // output can be then plotted using the DrawEvolution function // // Note that the output of different runlists can then be merged simply using // the hadd program, and so then the DrawEvolution can be used over // a huge period, e.g. a full year, while this method is better restricted // to a period or even less (depending on your success of accessing the OCDB) // std::vector<int> runs; ReadIntegers(runlist,runs); if ( runs.empty() ) { cout << "No runs to process..." << endl; return; } int year(2016); if ( runs[0] <= 139699 ) year=2010; if ( runs[0] <= 176000 ) year=2011; if ( runs[0] <= 195344 ) year = 2012; if ( runs[0] <= 198000 ) year = 2013; if ( runs[0] <= 246994 ) year = 2015; TString defaultOCDB; defaultOCDB.Form("local:///cvmfs/alice-ocdb.cern.ch/calibration/data/%d/OCDB",year); // defaultOCDB.Form("alien://folder=/alice/data/%d/OCDB?cacheFold=/local/cdb",year); AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data()); AliCDBManager::Instance()->SetRun(0); TList glist; glist.SetOwner(kTRUE); TGraph* gnbad = new TGraph(runs.size()); gnbad->SetName("nbad"); glist.Add(gnbad); TGraph* gnbadped = new TGraph(runs.size()); gnbadped->SetName("nbadped"); glist.Add(gnbadped); TGraph* gnbadocc = new TGraph(runs.size()); gnbadocc->SetName("nbadocc"); glist.Add(gnbadocc); TGraph* gnbadhv = new TGraph(runs.size()); gnbadhv->SetName("nbadhv"); glist.Add(gnbadhv); TGraph* gnmissing = new TGraph(runs.size()); gnmissing->SetName("nmissing"); glist.Add(gnmissing); TGraph* gnreco = new TGraph(runs.size()); gnreco->SetName("nreco"); glist.Add(gnreco); TGraph* gnbadlv = new TGraph(runs.size()); gnbadlv->SetName("nbadlv"); glist.Add(gnbadlv); for ( std::vector<int>::size_type i = 0; i < runs.size(); ++i ) { Int_t runNumber = runs[i]; Int_t nbadped; Int_t nbadhv; Int_t nbadlv; Int_t nbadocc; Int_t nmissing; Int_t nreco; Int_t nbad = GetBadChannels(runNumber,nbadped,nbadhv,nbadlv,nbadocc,nmissing,nreco); gnbad->SetPoint(i,runNumber,nbad); gnbadped->SetPoint(i,runNumber,nbadped); gnbadhv->SetPoint(i,runNumber,nbadhv); gnbadlv->SetPoint(i,runNumber,nbadlv); gnbadocc->SetPoint(i,runNumber,nbadocc); gnmissing->SetPoint(i,runNumber,nmissing); gnreco->SetPoint(i,runNumber,nreco); } TIter next(&glist); TGraph* g; Int_t index(0); TFile f(outfile,"recreate"); Int_t color[] = { 1 , 2 , 3 , 4, 6, 8, 7 }; Int_t marker[] = { 28 , 24 , 23 , 26, 30, 5, 32 }; while ( ( g = static_cast<TGraph*>(next() ) ) ) { g->GetXaxis()->SetNdivisions(505); g->GetXaxis()->SetNoExponent(); g->SetMinimum(0); g->GetYaxis()->SetNoExponent(); g->SetLineColor(color[index]); g->SetMarkerStyle(marker[index]); g->SetMarkerColor(color[index]); g->SetMarkerSize(1.0); ++index; g->Write(); } f.Close(); }
int merging() { Long_t NUMBER_OF_ENTRIES = 100; TTree* newResult = new TTree("xxx", "Argument"); static Double_t x, y; newResult->Branch("x", &x, "x/D"); newResult->Branch("y", &y, "y/D"); for(Long_t i=0; i<NUMBER_OF_ENTRIES; ++i) { x = i; y = i*i; //fprintf(stderr,"res %lf %lf %d\n",x,y,i<NUMBER_OF_ENTRIES); newResult->Fill(); }// end of for // newResult->Scan("x:y"); // ====================================== TMessage message(kMESS_OBJECT); message.Reset(); message.SetWriteMode(); message.WriteObject(newResult); message.Reset(); message.SetReadMode(); TTree* readResult = 0; readResult = ((TTree*)message.ReadObject(message.GetClass())); readResult->SetName("yyy"); // ====================================== TTree* result = 0; result = readResult->CloneTree(0); result->SetName("zzz"); result->Print(); result->Show(19); readResult->Print(); readResult->Show(29); cout<< "Result has " << result->GetEntries()<< " entries." << endl; TList newResultCollection; newResultCollection.SetOwner(kFALSE); newResultCollection.Add(readResult); cerr<<"Hello 1\n"; result->Merge(&newResultCollection); cerr<<"Hello 2\n"; cout<<result->GetEntries()<<endl; printf("result entries = %lld\n",result->GetEntries()); // ====================================== newResultCollection.Clear(); delete newResult; delete readResult; return 0; } // end of main
void MPDummyForLowStat(const char* stfile, int thr=30, int nGen=40,Bool_t bin=kTRUE) { // show degrees of freedom with low stat TFile* fl = TFile::Open(stfile); if (!fl) {printf("Failed to open %s\n",stfile); return;} TList* lst = (TList*)fl->Get("clist"); if (!lst) {printf("No clist in %s\n",stfile); return;} TH1* hstdof = (TH1*)lst->FindObject("DOFstat"); if (!hstdof) {printf("No DOFstat histo in %s\n",stfile); return;} // int ndof = hstdof->GetNbinsX(); TAxis* xax = hstdof->GetXaxis(); printf("%4s\t%-50s\t%s","cnt"," DOF ID_name","entries"); Mille* ml = 0; AliAlgSteer* algSteer=0; AliAlgMPRecord* mpRec=0; // if (bin) ml = new Mille(Form("%s.%s",mpDummy.Data(),"mille")); else { algSteer = new AliAlgSteer(); algSteer->SetMPDatFileName(mpDummy.Data()); algSteer->SetMPOutType(AliAlgSteer::kMPRec); algSteer->InitMPRecOutput(); mpRec = algSteer->GetMPRecord(); } // int labDum[1] = {0}, cnt=0; float locDum[1] = {0}, gloDum[1] = {kDummyDer}; // for (int i=1;i<=ndof;i++) { if (hstdof->GetBinContent(i)>thr) continue; TString labS = xax->GetBinLabel(i); printf("%4d\t%-50s\t%7d\n",cnt++,labS.Data(),(int)hstdof->GetBinContent(i)); int indL = labS.Index("_"); if (indL>0) labS.Resize(indL); else { printf("Failed to extract label from %s\n",labS.Data()); exit(1); } labDum[0] = labS.Atoi(); if (bin) { for (int j=nGen;j--;) { ml->mille(0, locDum, 1, gloDum, labDum, kDummyRes, kDummyErr); ml->end(); } } else { mpRec->DummyRecord(kDummyRes,kDummyErr,kDummyDer,labDum[0]); for (int j=nGen;j--;) algSteer->GetMPRecTree()->Fill(); } } // if (bin) delete ml; else { algSteer->CloseMPRecOutput(); delete algSteer; } // lst->SetOwner(); delete lst; fl->Close(); delete fl; }
void MakeSnapshot(Int_t run, const char* defStorage, TMap* specStorages, const char* snapshotFileName) { AliCDBManager *cdb = AliCDBManager::Instance(); cdb->SetDefaultStorage(defStorage); cdb->SetRun(run); TIter iter(specStorages->GetTable()); TPair *pair = 0; while((pair = dynamic_cast<TPair*> (iter.Next()))){ TObjString* caltype = dynamic_cast<TObjString*> (pair->Key()); TObjString* specstor= dynamic_cast<TObjString*> (pair->Value()); if (caltype && specstor) //TString calType = caltype->GetString(); //TString specStor = specstor->GetString(); //cdb->SetSpecificStorage(calType.Data(),specStor.Data()); cdb->SetSpecificStorage(caltype->GetString().Data(),specstor->GetString().Data()); else //AliFatal("Error reading info for specific storage") Printf("Error reading info for specific storage"); } // ********************************** GRP ****************************************** cdb->Get("GRP/CTP/Config"); cdb->Get("GRP/Calib/LHCClockPhase"); cdb->Get("GRP/GRP/Data"); cdb->Get("GRP/Align/Data"); cdb->Get("GRP/Calib/MeanVertexSPD"); cdb->Get("GRP/Calib/MeanVertex"); cdb->Get("GRP/Calib/MeanVertexTPC"); cdb->Get("GRP/Calib/CosmicTriggers"); cdb->Get("GRP/CTP/Scalers"); cdb->Get("GRP/CTP/CTPtiming"); cdb->Get("GRP/CTP/TimeAlign"); cdb->Get("GRP/GRP/LHCData"); cdb->Get("GRP/Calib/RecoParam"); // ********************************** ALL ****************************************** TString detStr = ("ITS TPC TRD TOF PHOS HMPID EMCAL MUON ZDC PMD T0 VZERO"); //TString detStr = ("ITS MUON TPC"); TObjArray *arr = detStr.Tokenize(' '); for (Int_t iDet=0; iDet<arr->GetEntries(); iDet++) { TObjString *detOStr = dynamic_cast<TObjString*>(arr->At(iDet)); AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",detOStr->GetString().Data())); AliCDBManager::Instance()->Get(Form("%s/Align/Data",detOStr->GetString().Data())); } // ******************************** TRIGGER **************************************** // Temporary fix - one has to define the correct policy in order // to load the trigger OCDB entries only for the detectors that // in the trigger or that are needed in order to put correct // information in ESD AliCDBManager::Instance()->GetAll("TRIGGER/*/*"); // ********************************** HLT ****************************************** // cdb->Get("HLT/ConfigHLT/esdLayout"); // cdb->Get("HLT/Calib/StreamerInfo"); TMap* entriesMap = const_cast<TMap*>(cdb->GetEntryCache()); Printf("\nentriesMap has %d entries!\n", entriesMap->GetEntries()); TList* entriesList = const_cast<TList*>(cdb->GetRetrievedIds()); Printf("\nentriesList has %d entries!\n", entriesList->GetEntries()); //TString filename(TString::Format("CDBsnapshot_Run%d.root",run)); TString filename(snapshotFileName); TFile *f = new TFile(filename.Data(),"recreate"); f->cd(); f->WriteObject(entriesMap,"entriesMap"); f->WriteObject(entriesList,"entriesList"); f->Close(); entriesMap->SetOwnerKeyValue(kFALSE,kFALSE); entriesList->SetOwner(kFALSE); }
void AddTask_GammaCaloDalitzV1_pPb( Int_t trainConfig = 1, //change different set of cuts Bool_t isMC = kFALSE, //run MC Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1 Int_t enableQAPhotonTask = 0, // enable additional QA task TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input Int_t doWeightingPart = 0, //enable Weighting TString generatorName = "DPMJET", TString cutnumberAODBranch = "8000000060084000001500000", // cutnumber for AOD branch Bool_t enableExtendedMatching = kFALSE, //enable or disable extended matching histograms for conversion electrons <-> cluster Bool_t isUsingTHnSparse = kTRUE, //enable or disable usage of THnSparses for background estimation Bool_t enableV0findingEffi = kFALSE ) { Int_t isHeavyIon = 2; // ================== GetAnalysisManager =============================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found."); return ; } // ================== GetInputEventHandler ============================= AliVEventHandler *inputHandler=mgr->GetInputEventHandler(); //========= Add PID Reponse to ANALYSIS manager ==== if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){ gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); AddTaskPIDResponse(isMC); } Printf("here \n"); //========= Set Cutnumber for V0Reader ================================ //06000078400100001500000000 TString cutnumberPhoton = "06000078400100007500000000"; TString cutnumberEvent = "80000003"; TString cutnumberElectron = "90005400000002000000"; //Electron Cuts Bool_t doEtaShift = kFALSE; AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); //========= Add V0 Reader to ANALYSIS manager if not yet existent ===== TString V0ReaderName = Form("V0ReaderV1_%s_%s",cutnumberEvent.Data(),cutnumberPhoton.Data()); if( !(AliV0ReaderV1*)mgr->GetTask(V0ReaderName.Data()) ){ AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1(V0ReaderName.Data()); fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE); fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output fV0ReaderV1->SetUseAODConversionPhoton(kTRUE); fV0ReaderV1->SetProduceV0FindingEfficiency(enableV0findingEffi); if (!mgr) { Error("AddTask_V0ReaderV1", "No analysis manager found."); return; } AliConvEventCuts *fEventCuts=NULL; if(cutnumberEvent!=""){ fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data()); fEventCuts->SetPreSelectionCutFlag(kTRUE); fEventCuts->SetV0ReaderName(V0ReaderName); if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){ fEventCuts->DoEtaShift(doEtaShift); fV0ReaderV1->SetEventCuts(fEventCuts); fEventCuts->SetFillCutHistograms("",kTRUE); } } // Set AnalysisCut Number AliConversionPhotonCuts *fCuts=NULL; if(cutnumberPhoton!=""){ fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data()); fCuts->SetPreSelectionCutFlag(kTRUE); fCuts->SetIsHeavyIon(isHeavyIon); fCuts->SetV0ReaderName(V0ReaderName); if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){ fV0ReaderV1->SetConversionCuts(fCuts); fCuts->SetFillCutHistograms("",kTRUE); } } if(inputHandler->IsA()==AliAODInputHandler::Class()){ // AOD mode fV0ReaderV1->AliV0ReaderV1::SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data())); } fV0ReaderV1->Init(); AliLog::SetGlobalLogLevel(AliLog::kFatal); //connect input V0Reader mgr->AddTask(fV0ReaderV1); mgr->ConnectInput(fV0ReaderV1,0,cinput); } //================================================ //========= Add Electron Selector ================ if( !(AliDalitzElectronSelector*)mgr->GetTask("ElectronSelector") ){ AliDalitzElectronSelector *fElectronSelector = new AliDalitzElectronSelector("ElectronSelector"); // Set AnalysisCut Number AliDalitzElectronCuts *fElecCuts=0; if( cutnumberElectron!=""){ fElecCuts= new AliDalitzElectronCuts(cutnumberElectron.Data(),cutnumberElectron.Data()); if(fElecCuts->InitializeCutsFromCutString(cutnumberElectron.Data())){ fElectronSelector->SetDalitzElectronCuts(fElecCuts); fElecCuts->SetFillCutHistograms("",kTRUE); } } fElectronSelector->Init(); mgr->AddTask(fElectronSelector); AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); //connect input V0Reader mgr->ConnectInput (fElectronSelector,0,cinput1); } //================================================ //========= Add task to the ANALYSIS manager ===== //================================================ AliAnalysisTaskGammaCaloDalitzV1 *task=NULL; task= new AliAnalysisTaskGammaCaloDalitzV1(Form("GammaCaloDalitz_%i",trainConfig)); task->SetIsHeavyIon(isHeavyIon); task->SetIsMC(isMC); task->SetV0ReaderName(V0ReaderName); // Cut Numbers to use in Analysis Int_t numberOfCuts = 2; if ( trainConfig == 1 || trainConfig == 2 ) numberOfCuts = 4; TString *eventCutArray = new TString[numberOfCuts]; TString *photonCutArray = new TString[numberOfCuts]; TString *clusterCutArray = new TString[numberOfCuts]; TString *electronCutArray = new TString[numberOfCuts]; TString *mesonCutArray = new TString[numberOfCuts]; //************************************************ EMCAL clusters ********************************************************** if ( trainConfig == 1){ // min energy = 0.3 GeV/c eventCutArray[0] = "80000013"; photonCutArray[0] = "00200009327002008250400000"; clusterCutArray[0] = "1111100043022030000"; electronCutArray[0] = "90475400233102623710"; mesonCutArray[0] = "0263103100000000"; //standart cut, kINT7 eventCutArray[1] = "80052013"; photonCutArray[1] = "00200009327002008250400000"; clusterCutArray[1] = "1111100043022030000"; electronCutArray[1] = "90475400233102623710"; mesonCutArray[1] = "0263103100000000"; //standard cut, kEMC7 eventCutArray[2] = "80000013"; photonCutArray[2] = "00200009327002008250400000"; clusterCutArray[2] = "1111100043022030000"; electronCutArray[2] = "90475400233102623110"; mesonCutArray[2] = "0263103100000000"; //standart cut, kINT7 eventCutArray[3] = "80052013"; photonCutArray[3] = "00200009327002008250400000"; clusterCutArray[3] = "1111100043022030000"; electronCutArray[3] = "90475400233102623110"; mesonCutArray[3] = "0263103100000000"; //standard cut, kEMC7 } else if ( trainConfig == 2 ){ eventCutArray[0] = "80000013"; photonCutArray[0] = "00200009327002008250400000"; clusterCutArray[0] = "2000000048033200000"; electronCutArray[0] = "90475400233102623710"; mesonCutArray[0] = "0263103100000000"; //standart cut, kINT7 eventCutArray[1] = "80062013"; photonCutArray[1] = "00200009327002008250400000"; clusterCutArray[1] = "2000000048033200000"; electronCutArray[1] = "90475400233102623710"; mesonCutArray[1] = "0263103100000000"; //standard cut, kPHI7 eventCutArray[2] = "80000013"; photonCutArray[2] = "00200009327002008250400000"; clusterCutArray[2] = "2000000048033200000"; electronCutArray[2] = "90475400233102623110"; mesonCutArray[2] = "0263103100000000"; //standart cut, kINT7 eventCutArray[3] = "80062013"; photonCutArray[3] = "00200009327002008250400000"; clusterCutArray[3] = "2000000048033200000"; electronCutArray[3] = "90475400233102623110"; mesonCutArray[3] = "0263103100000000"; //standard cut, kPHI7 } else if ( trainConfig == 3){ // min energy = 0.3 GeV/c eventCutArray[0] = "80000013"; photonCutArray[0] = "00200009327002008250400000"; clusterCutArray[0] = "1111100053032230000"; electronCutArray[0] = "90475400233102623710"; mesonCutArray[0] = "0263103100000000"; //standart cut, kINT7 eventCutArray[1] = "80000013"; photonCutArray[1] = "00200009327002008250400000"; clusterCutArray[1] = "1331100053032230000"; electronCutArray[1] = "90475400233102623710"; mesonCutArray[1] = "0263103100000000"; //standard cut, kEMC7 } else if ( trainConfig == 4){ eventCutArray[0] = "80000013"; photonCutArray[0] = "00200009327002008250400000"; clusterCutArray[0] = "2000000048033200000"; electronCutArray[0] = "90475400233102623710"; mesonCutArray[0] = "0263103100000000"; //standart cut, kINT7 eventCutArray[1] = "80000013"; photonCutArray[1] = "00200009327002008250400000"; clusterCutArray[1] = "2444400048033200000"; electronCutArray[1] = "90475400233102623710"; mesonCutArray[1] = "0263103100000000"; //standard cut, kPHI7 } else if ( trainConfig == 5 ){ eventCutArray[0] = "80000013"; photonCutArray[0] = "00200009327002008250400000"; clusterCutArray[0] = "1002100053032230000"; electronCutArray[0] = "90475400233102623710"; mesonCutArray[0] = "0263103100000000"; //standart cut, kINT7 with TRD eventCutArray[1] = "80000013"; photonCutArray[1] = "00200009327002008250400000"; clusterCutArray[1] = "1001300053032230000"; electronCutArray[1] = "90475400233102623710"; mesonCutArray[1] = "0263103100000000"; //standard cut, kINT7 No TRD } else if ( trainConfig == 6 ) { eventCutArray[0] = "80000013"; photonCutArray[0] = "00200009327002008250400000"; clusterCutArray[0] = "2000000048033300000"; electronCutArray[0] = "90475400233102623710"; mesonCutArray[0] = "0263103100000000"; //standart cut, kINT7 eventCutArray[1] = "80000013"; photonCutArray[1] = "00200009327002008250400000"; clusterCutArray[1] = "2444400048033300000"; electronCutArray[1] = "90475400233102623710"; mesonCutArray[1] = "0263103100000000"; //standard cut, kINT7 } else if ( trainConfig == 7 ){ // min energy = 0.3 GeV/c eventCutArray[0] = "80000013"; photonCutArray[0] = "00200009327002008250400000"; clusterCutArray[0] = "1221100053032230000"; electronCutArray[0] = "90475400233102623710"; mesonCutArray[0] = "0263103100000000"; //standart cut, kINT7 eventCutArray[1] = "80000013"; photonCutArray[1] = "00200009327002008250400000"; clusterCutArray[1] = "1331100053032230000"; electronCutArray[1] = "90475400233102623710"; mesonCutArray[1] = "0263103100000000"; //standard cut, kEMC7 } else { Error(Form("GammaConvDalitzCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration"); return; } TList *EventCutList = new TList(); TList *ConvCutList = new TList(); TList *ClusterCutList = new TList(); TList *ElectronCutList = new TList(); TList *MesonCutList = new TList(); TList *HeaderList = new TList(); if (doWeightingPart==1) { TObjString *Header1 = new TObjString("pi0_1"); HeaderList->Add(Header1); } if (doWeightingPart==2){ TObjString *Header3 = new TObjString("eta_2"); HeaderList->Add(Header3); } if (doWeightingPart==3) { TObjString *Header1 = new TObjString("pi0_1"); HeaderList->Add(Header1); TObjString *Header3 = new TObjString("eta_2"); HeaderList->Add(Header3); } EventCutList->SetOwner(kTRUE); AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts]; ConvCutList->SetOwner(kTRUE); AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts]; ClusterCutList->SetOwner(kTRUE); AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts]; ElectronCutList->SetOwner(kTRUE); AliDalitzElectronCuts **analysisElectronCuts = new AliDalitzElectronCuts*[numberOfCuts]; MesonCutList->SetOwner(kTRUE); AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts]; for(Int_t i = 0; i<numberOfCuts; i++){ //create AliCaloTrackMatcher instance, if there is none present TString caloCutPos = clusterCutArray[i]; caloCutPos.Resize(1); TString TrackMatcherName = Form("CaloTrackMatcher_%s",caloCutPos.Data()); if( !(AliCaloTrackMatcher*)mgr->GetTask(TrackMatcherName.Data()) ){ AliCaloTrackMatcher* fTrackMatcher = new AliCaloTrackMatcher(TrackMatcherName.Data(),caloCutPos.Atoi()); fTrackMatcher->SetV0ReaderName(V0ReaderName); mgr->AddTask(fTrackMatcher); mgr->ConnectInput(fTrackMatcher,0,cinput); } analysisEventCuts[i] = new AliConvEventCuts(); analysisEventCuts[i]->SetV0ReaderName(V0ReaderName); analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data()); EventCutList->Add(analysisEventCuts[i]); analysisEventCuts[i]->SetFillCutHistograms("",kFALSE); analysisCuts[i] = new AliConversionPhotonCuts(); analysisCuts[i]->SetV0ReaderName(V0ReaderName); analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data()); analysisCuts[i]->SetIsHeavyIon(isHeavyIon); ConvCutList->Add(analysisCuts[i]); analysisCuts[i]->SetFillCutHistograms("",kFALSE); analysisClusterCuts[i] = new AliCaloPhotonCuts(); analysisClusterCuts[i]->SetV0ReaderName(V0ReaderName); analysisClusterCuts[i]->SetCaloTrackMatcherName(TrackMatcherName); analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data()); ClusterCutList->Add(analysisClusterCuts[i]); analysisClusterCuts[i]->SetExtendedMatching(enableExtendedMatching); analysisClusterCuts[i]->SetFillCutHistograms(""); analysisElectronCuts[i] = new AliDalitzElectronCuts(); if( !analysisElectronCuts[i]->InitializeCutsFromCutString(electronCutArray[i].Data())) { cout<< "ERROR: analysisElectronCuts [ " <<i<<" ] "<<endl; return 0; } ElectronCutList->Add(analysisElectronCuts[i]); analysisElectronCuts[i]->SetFillCutHistograms("",kFALSE,electronCutArray[i].Data()); analysisMesonCuts[i] = new AliConversionMesonCuts(); analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data()); MesonCutList->Add(analysisMesonCuts[i]); analysisMesonCuts[i]->SetFillCutHistograms(""); analysisEventCuts[i]->SetAcceptedHeader(HeaderList); } task->SetEventCutList(numberOfCuts,EventCutList); task->SetConversionCutList(numberOfCuts,ConvCutList); task->SetCaloCutList(numberOfCuts,ClusterCutList); task->SetMesonCutList(numberOfCuts,MesonCutList); task->SetElectronCutList(numberOfCuts,ElectronCutList); task->SetMoveParticleAccordingToVertex(kTRUE); task->SetDoMesonAnalysis(kTRUE); task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA task->SetDoClusterQA(1); //Attention new switch small for Cluster QA task->SetUseTHnSparse(isUsingTHnSparse); //connect containers AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("GammaCaloDalitz_%i",trainConfig), TList::Class(), AliAnalysisManager::kOutputContainer,Form("GammaCaloDalitz_%i.root",trainConfig)); mgr->AddTask(task); mgr->ConnectInput(task,0,cinput); mgr->ConnectOutput(task,1,coutput); return; }