]>
Commit | Line | Data |
---|---|---|
02f0b8e7 | 1 | void Embedding(const char* dataset="collection.xml") |
2 | { | |
3 | ||
4 | gSystem->Load("libTree.so"); | |
5 | gSystem->Load("libGeom.so"); | |
6 | gSystem->Load("libVMC.so"); | |
7 | gSystem->Load("libPhysics.so"); | |
8 | ||
9 | //load analysis framework | |
10 | gSystem->Load("libANALYSIS"); | |
11 | gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE | |
12 | ||
13 | gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS"); | |
14 | ||
15 | // A task can be compiled dynamically with AClic | |
16 | gROOT->LoadMacro("AliPHOSEmbedding.cxx+g"); | |
17 | ||
18 | // Connect to alien | |
19 | TString token = gSystem->Getenv("GRID_TOKEN") ; | |
20 | if (1) // token == "OK" ) | |
21 | TGrid::Connect("alien://"); | |
22 | else | |
23 | AliInfo("You are not connected to the GRID") ; | |
24 | cout << "Pi0Analysis: processing collection " << dataset << endl; | |
25 | ||
26 | // Create the chain | |
27 | TChain* chain = new TChain("esdTree"); | |
28 | ||
29 | chain->Add("/home/prsnko/PbPb/Embedding/Data/AliESDs.root") ; | |
30 | /* | |
31 | ||
32 | TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset)); | |
33 | ||
34 | TAlienResult* result = collection->GetGridResult("",0 ,0); | |
35 | TList* rawFileList = result->GetFileInfoList(); | |
36 | for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) { | |
37 | TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(counter)) ; | |
38 | const char * rawFile = fi->GetCurrentUrl()->GetUrl() ; | |
39 | printf("Processing %s\n", rawFile) ; | |
40 | chain->Add(rawFile); | |
41 | printf("Chain: %d entries.\n",chain->GetEntries()); | |
42 | } | |
43 | TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(0)); | |
44 | const char * fn = fi->GetCurrentUrl()->GetUrl() ; | |
45 | */ | |
46 | char runNum[7]={"139438"}; | |
47 | // for(Int_t i=0;i<6;i++)runNum[i]=fn[35+i] ; | |
48 | runNum[6]=0 ; | |
49 | Int_t iRunNum=atoi(runNum) ; | |
50 | printf("Run number=%d \n",iRunNum) ; | |
51 | ||
52 | //Run AOD simulation | |
53 | int nrun = atoi(runNum); | |
54 | int nevent = 0; | |
55 | int seed = 0; | |
56 | ||
57 | char sseed[1024]; | |
58 | char sevent[1024]; | |
59 | char sprocess[1024]; | |
60 | char sfield[1024]; | |
61 | char senergy[1024]; | |
62 | ||
63 | sprintf(sevent,""); | |
64 | sprintf(sprocess,""); | |
65 | sprintf(sfield,""); | |
66 | sprintf(senergy,""); | |
67 | ||
68 | seed = 0; | |
69 | sprintf(sseed,"%d",seed); | |
70 | ||
71 | if (seed==0) { | |
72 | fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); | |
73 | fprintf(stderr,"!!!! WARNING! Seeding variable for MC is 0 !!!!\n"); | |
74 | fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); | |
75 | } else { | |
76 | fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); | |
77 | fprintf(stdout,"!!! MC Seed is %d \n",seed); | |
78 | fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); | |
79 | } | |
80 | ||
81 | // set the seed environment variable | |
82 | gSystem->Setenv("CONFIG_SEED",sseed); | |
83 | gSystem->Setenv("CONFIG_RUN_TYPE","kPythia6"); // kPythia6 or kPhojet^M | |
84 | gSystem->Setenv("CONFIG_FIELD","k5kG"); // kNoField or k5kG^M | |
85 | gSystem->Setenv("CONFIG_ENERGY","2760"); // 900 or 10000 (GeV) | |
86 | gSystem->Setenv("DC_RUN",runNum); //run number | |
87 | ||
88 | ||
89 | char nSimEvents[55] ; | |
90 | sprintf(nSimEvents,"%d",chain->GetEntries()); | |
91 | gSystem->Setenv("SIM_EVENTS",nSimEvents); | |
92 | gSystem->Exec("mv geometry.root geometry_PHOS.root") ; | |
93 | // gSystem->Exec("aliroot -b -q simrun.C > simrun.log 2>&1"); | |
94 | gSystem->Exec("mv geometry_PHOS.root geometry.root") ; | |
95 | ||
96 | // Make the analysis manager | |
97 | AliAnalysisManager *mgr = new AliAnalysisManager("Pi0EmbeddingManager"); | |
98 | ||
99 | // ESD input handler | |
100 | AliESDInputHandler* esdH = new AliESDInputHandler(); | |
101 | esdH->SetReadFriends(kFALSE); | |
102 | mgr->SetInputEventHandler(esdH); | |
103 | ||
104 | // Output | |
105 | AliAODHandler* aodHandler = new AliAODHandler(); | |
106 | aodHandler->SetOutputFileName("AliAODout.root"); | |
107 | mgr->SetOutputEventHandler(aodHandler); | |
108 | ||
109 | ||
110 | // Debug level | |
111 | mgr->SetDebugLevel(0); | |
112 | ||
113 | // Add physics selection | |
114 | // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
115 | // AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE,kFALSE); | |
116 | ||
117 | //Add centrality | |
118 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); | |
119 | AliCentralitySelectionTask *taskCentrality = AddTaskCentrality() ; | |
120 | taskCentrality->SetPass(2); // remember to set the pass you are processing!!! | |
121 | ||
122 | // Add my task | |
123 | AliPHOSEmbedding *task1 = new AliPHOSEmbedding("Embedding"); | |
124 | ||
125 | TChain* chainAOD = new TChain("aodTree"); | |
126 | chainAOD->AddFile("AliAOD.root") ; | |
127 | task1->SetSignalChain(chainAOD) ; | |
128 | // task1->SelectCollisionCandidates(); | |
129 | ||
130 | ||
131 | TFile *fOldCalib = TFile::Open("OldCalibration.root"); | |
132 | if(fOldCalib->IsOpen()){ | |
133 | printf("\n\n...Adding PHOS calibration used in ESD production \n") ; | |
134 | char key[55] ; | |
135 | TH2F * hCalib[5] ; | |
136 | for(Int_t mod=0;mod<5; mod++){ | |
137 | sprintf(key,"calibrationMod%d",mod) ; | |
138 | hCalib[mod] = (TH2F*)fOldCalib->Get(key) ; | |
139 | } | |
140 | task1->SetOldCalibration(hCalib) ; | |
141 | fOldCalib->Close() ; | |
142 | } | |
143 | ||
144 | mgr->AddTask(task1); | |
145 | ||
146 | // Create containers for input/output | |
147 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); | |
148 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("output0", | |
149 | TTree::Class(), AliAnalysisManager::kOutputContainer); | |
150 | ||
151 | ||
152 | // Connect input/output | |
153 | mgr->ConnectInput(task1 , 0, cinput); | |
154 | mgr->ConnectOutput(task1, 0,coutput1); | |
155 | ||
156 | AliLog::SetClassDebugLevel("AliGeomManager", 10) ; | |
157 | ||
158 | AliCDBManager::Instance()->SetRun(iRunNum) ; | |
159 | // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB") ; | |
160 | // AliCDBManager::Instance()->SetDefaultStorage("raw://") ; | |
161 | AliCDBManager::Instance()->SetDefaultStorage("alien://folder=/alice/data/2010/OCDB") ; | |
162 | AliCDBManager::Instance()->SetSpecificStorage("PHOS/*/*", | |
163 | "local://OCDB"); | |
164 | printf("RunNunm===%d \n",iRunNum) ; | |
165 | ||
166 | ||
167 | if (mgr->InitAnalysis()) { | |
168 | mgr->PrintStatus(); | |
169 | mgr->StartAnalysis("local", chain); | |
170 | } | |
171 | ||
172 | if(iRunNum<=137848){ //period 1 | |
173 | gSystem->Exec("mv BadMap_LHC10h_period1.root BadMap_LHC10h.root") ; | |
174 | } | |
175 | else{ | |
176 | gSystem->Exec("mv BadMap_LHC10h_period234.root BadMap_LHC10h.root") ; | |
177 | } | |
178 | // gSystem->Exec("aliroot -b -q Analyze.C> analyze.log 2>&1"); | |
179 | ||
180 | } |