Fork me on GitHub

source: svn/trunk/src/FrogUtil.cc@ 98

Last change on this file since 98 was 97, checked in by severine ovyn, 16 years ago

Frog stuffs

File size: 25.6 KB
Line 
1/*
2 * ---- Delphes ----
3 * A Fast Simulator for general purpose LHC detector
4 * S. Ovyn ~~~~ severine.ovyn@uclouvain.be
5 *
6 * Center for Particle Physics and Phenomenology (CP3)
7 * Universite Catholique de Louvain (UCL)
8 * Louvain-la-Neuve, Belgium
9 * */
10
11// \brief Trigger class, and some generic definitions
12
13#include "interface/FrogUtil.h"
14#include "TRandom.h"
15
16#include "Utilities/FROG/Includes/FROG/FROG_DetId.h"
17#include "Utilities/FROG/Includes/FROG/FROG_Geometry.h"
18#include "Utilities/FROG/Includes/FROG/FROG_Geometry.cpp"
19#include "Utilities/FROG/Includes/FROG/FROG_Events.h"
20#include "Utilities/FROG/Includes/FROG/FROG_Events.cpp"
21#include "Utilities/FROG/Includes/FROG/FROG_Element_Tools.h"
22#include "Utilities/FROG/Includes/FROG/FROG_Element_Tools.cpp"
23#include "Utilities/FROG/Includes/FROG/FROG_Net_Tools.h"
24#include "Utilities/FROG/Includes/FROG/FROG_Net_Tools.cpp"
25#include "Utilities/FROG/Includes/FROG/FROG_Path.h"
26#include "Utilities/FROG/Includes/FROG/FROG_Path.cpp"
27#include "Utilities/FROG/Includes/FROG/FROG_Coord.h"
28#include "Utilities/FROG/Includes/FROG/FROG_Coord.cpp"
29#include "Utilities/FROG/Includes/FROG/FROG_ReadCards.h"
30#include "Utilities/FROG/Includes/FROG/FROG_ReadCards.cpp"
31#include "Utilities/FROG/Includes/FROG/FROG_ZLib.h"
32#include "Utilities/FROG/Includes/FROG/FROG_ZLib.cpp"
33
34#include <iostream>
35#include <sstream>
36#include <fstream>
37#include <iomanip>
38#include <cstring>
39
40using namespace std;
41using namespace FROG_COORD;
42
43
44FrogDisplay::FrogDisplay() {}
45
46//PROTON 1
47void FrogDisplay::Build_1Event(FROG_Element_Event* event1)
48{
49 double posp_x = 0.0299923*1000;
50 double posp_y = 0.00602767*1000;
51 double posp_z = 0;
52 FROG_Element_Event_Hit* hitp = new FROG_Element_Event_Hit(500000001 + ((int)posp_z)/50, posp_x, posp_y, posp_z, -1);
53 double dirp_x = 0*1000;
54 double dirp_y = 0*1000;
55 double dirp_z = -1*1000;
56 float Pp = sqrt(dirp_x*dirp_x + dirp_y*dirp_y + dirp_z*dirp_z);
57 float Ptp = sqrt(dirp_x*dirp_x + dirp_y*dirp_y);
58 FROG_Element_Base_With_DetId_And_Name* trackCollectionP = new FROG_Element_Base_With_DetId_And_Name(EVTID_TRK+1000, "Tracks: protons");
59 FROG_Element_Event_Track* trackp= new FROG_Element_Event_Track(0,Pp,Ptp,0);
60 trackp->addDaughter(hitp);
61 double pos2p_x = 0.0299923*1000+0*1000*0.4;
62 double pos2p_y = 0.00602767*1000+0*1000*0.4;
63 double pos2p_z = -1*1000*0.4;
64 FROG_Element_Event_Hit* hit2p = new FROG_Element_Event_Hit(500000001 + ((int)pos2p_z)/50, pos2p_x, pos2p_y, pos2p_z, -1);
65 trackp->addDaughter(hit2p);
66 trackCollectionP->addDaughter(trackp);
67
68 // photon 1
69 FROG_Element_Base_With_DetId_And_Name* trackCollection = new FROG_Element_Base_With_DetId_And_Name(EVTID_TRK,"Tracks: Photons");
70 FROG_Element_Event_Track* track1 = new FROG_Element_Event_Track(0,1,1,0);
71 double pos0_x = 0.0299923*1000;
72 double pos0_y = 0.00602767*1000;
73 double pos0_z = -0.309438*1000;
74 FROG_Element_Event_Hit* hit0 = new FROG_Element_Event_Hit(400000001 + ((int)pos0_z)/50, pos0_x, pos0_y, pos0_z, -1);
75 track1->addDaughter(hit0);
76 double pos1_x = 0.03*1000;
77 double pos1_y = 0.00602856*1000;
78 double pos1_z = -0.309567*1000;
79 FROG_Element_Event_Hit* hit1 = new FROG_Element_Event_Hit(400000001 + ((int)pos1_z)/50, pos1_x, pos1_y, pos1_z, -1);
80 track1->addDaughter(hit1);
81 trackCollection->addDaughter(track1);
82 // photon 2
83 FROG_Element_Event_Track* track2 = new FROG_Element_Event_Track(0,1,1,0);
84 double pos2_x = 0.0299923*1000;
85 double pos2_y = 0.00602767*1000;
86 double pos2_z = -0.312795*1000;
87 FROG_Element_Event_Hit* hit2 = new FROG_Element_Event_Hit(400000001 + ((int)pos2_z)/50, pos2_x, pos2_y, pos2_z, -1);
88 track2->addDaughter(hit2);
89 double pos3_x = 0.0291312*1000;
90 double pos3_y = 0.00599684*1000;
91 double pos3_z = -0.326865*1000;
92 FROG_Element_Event_Hit* hit3 = new FROG_Element_Event_Hit(400000001 + ((int)pos3_z)/50, pos3_x, pos3_y, pos3_z, -1);
93 track2->addDaughter(hit3);
94 double pos4_x = 0.0272812*1000;
95 double pos4_y = 0*1000;
96 double pos4_z = -0.325133*1000;
97 FROG_Element_Event_Hit* hit4 = new FROG_Element_Event_Hit(400000001 + ((int)pos4_z)/50, pos4_x, pos4_y, pos4_z, -1);
98 track2->addDaughter(hit4);
99 double pos5_x = 0.0147219*1000;
100 double pos5_y = -0.04071*1000;
101 double pos5_z = -0.313375*1000;
102 FROG_Element_Event_Hit* hit5 = new FROG_Element_Event_Hit(400000001 + ((int)pos5_z)/50, pos5_x, pos5_y, pos5_z, -1);
103 track2->addDaughter(hit5);
104 trackCollection->addDaughter(track2);
105
106 // photon 3
107 FROG_Element_Event_Track* track3 = new FROG_Element_Event_Track(0,1,1,0);
108 double pos6_x = 0.0299923*1000;
109 double pos6_y = 0.00602767*1000;
110 double pos6_z = -0.241733*1000;
111 FROG_Element_Event_Hit* hit6 = new FROG_Element_Event_Hit(400000001 + ((int)pos6_z)/50, pos6_x, pos6_y, pos6_z, -1);
112 track3->addDaughter(hit6);
113 double pos7_x = 0.0247239*1000;
114 double pos7_y = 0.00635725*1000;
115 double pos7_z = -0.327258*1000;
116 FROG_Element_Event_Hit* hit7 = new FROG_Element_Event_Hit(400000001 + ((int)pos7_z)/50, pos7_x, pos7_y, pos7_z, -1);
117 track3->addDaughter(hit7);
118 double pos8_x = 0.023245*1000;
119 double pos8_y = 0*1000;
120 double pos8_z = -0.325292*1000;
121 FROG_Element_Event_Hit* hit8 = new FROG_Element_Event_Hit(400000001 + ((int)pos8_z)/50, pos8_x, pos8_y, pos8_z, -1);
122 track3->addDaughter(hit8);
123 double pos9_x = 0.0137742*1000;
124 double pos9_y = -0.04071*1000;
125 double pos9_z = -0.312698*1000;
126 FROG_Element_Event_Hit* hit9 = new FROG_Element_Event_Hit(400000001 + ((int)pos9_z)/50, pos9_x, pos9_y, pos9_z, -1);
127 track3->addDaughter(hit9);
128 trackCollection->addDaughter(track3);
129
130 // photon 4
131 FROG_Element_Event_Track* track4 = new FROG_Element_Event_Track(0,1,1,0);
132 double pos10_x = 0.0299923*1000;
133 double pos10_y = 0.00602767*1000;
134 double pos10_z = -0.103114*1000;
135 FROG_Element_Event_Hit* hit10 = new FROG_Element_Event_Hit(400000001 + ((int)pos10_z)/50, pos10_x, pos10_y, pos10_z, -1);
136 track4->addDaughter(hit10);
137 double pos11_x = 0.0169713*1000;
138 double pos11_y = 0.0106604*1000;
139 double pos11_z = -0.324528*1000;
140 FROG_Element_Event_Hit* hit11 = new FROG_Element_Event_Hit(400000001 + ((int)pos11_z)/50, pos11_x, pos11_y, pos11_z, -1);
141 track4->addDaughter(hit11);
142 double pos12_x = 0.0159847*1000;
143 double pos12_y = 0*1000;
144 double pos12_z = -0.322034*1000;
145 FROG_Element_Event_Hit* hit12 = new FROG_Element_Event_Hit(400000001 + ((int)pos12_z)/50, pos12_x, pos12_y, pos12_z, -1);
146 track4->addDaughter(hit12);
147 double pos13_x = 0.00925296*1000;
148 double pos13_y = -0.0727334*1000;
149 double pos13_z = -0.305018*1000;
150 FROG_Element_Event_Hit* hit13 = new FROG_Element_Event_Hit(400000001 + ((int)pos13_z)/50, pos13_x, pos13_y, pos13_z, -1);
151 track4->addDaughter(hit13);
152 trackCollection->addDaughter(track4);
153
154 // photon 5
155 FROG_Element_Event_Track* track5 = new FROG_Element_Event_Track(0,1,1,0);
156 double pos14_x = 0.0299923*1000;
157 double pos14_y = 0.00602767*1000;
158 double pos14_z = -0.0550703*1000;
159 FROG_Element_Event_Hit* hit14 = new FROG_Element_Event_Hit(400000001 + ((int)pos14_z)/50, pos14_x, pos14_y, pos14_z, -1);
160 track5->addDaughter(hit14);
161 double pos15_x = 0.03*1000;
162 double pos15_y = 0.00597767*1000;
163 double pos15_z = -0.0558923*1000;
164 FROG_Element_Event_Hit* hit15 = new FROG_Element_Event_Hit(400000001 + ((int)pos15_z)/50, pos15_x, pos15_y, pos15_z, -1);
165 track5->addDaughter(hit15);
166 trackCollection->addDaughter(track5);
167
168 // photon 6
169 FROG_Element_Event_Track* track6 = new FROG_Element_Event_Track(0,1,1,0);
170 double pos16_x = 0.0299923*1000;
171 double pos16_y = 0.00602767*1000;
172 double pos16_z = -0.0724158*1000;
173 FROG_Element_Event_Hit* hit16 = new FROG_Element_Event_Hit(400000001 + ((int)pos16_z)/50, pos16_x, pos16_y, pos16_z, -1);
174 track6->addDaughter(hit16);
175 double pos17_x = 0.03*1000;
176 double pos17_y = 0.00602949*1000;
177 double pos17_z = -0.0725471*1000;
178 FROG_Element_Event_Hit* hit17 = new FROG_Element_Event_Hit(400000001 + ((int)pos17_z)/50, pos17_x, pos17_y, pos17_z, -1);
179 track6->addDaughter(hit17);
180 trackCollection->addDaughter(track6);
181
182 // photon 7
183 FROG_Element_Event_Track* track7 = new FROG_Element_Event_Track(0,1,1,0);
184 double pos18_x = 0.0299923*1000;
185 double pos18_y = 0.00602767*1000;
186 double pos18_z = -0.108963*1000;
187 FROG_Element_Event_Hit* hit18 = new FROG_Element_Event_Hit(400000001 + ((int)pos18_z)/50, pos18_x, pos18_y, pos18_z, -1);
188 track7->addDaughter(hit18);
189 double pos19_x = 0.03*1000;
190 double pos19_y = 0.0060305*1000;
191 double pos19_z = -0.109102*1000;
192 FROG_Element_Event_Hit* hit19 = new FROG_Element_Event_Hit(400000001 + ((int)pos19_z)/50, pos19_x, pos19_y, pos19_z, -1);
193 track7->addDaughter(hit19);
194 trackCollection->addDaughter(track7);
195
196 // photon 8
197 FROG_Element_Event_Track* track8 = new FROG_Element_Event_Track(0,1,1,0);
198 double pos20_x = 0.0299923*1000;
199 double pos20_y = 0.00602767*1000;
200 double pos20_z = -0.189456*1000;
201 FROG_Element_Event_Hit* hit20 = new FROG_Element_Event_Hit(400000001 + ((int)pos20_z)/50, pos20_x, pos20_y, pos20_z, -1);
202 track8->addDaughter(hit20);
203 double pos21_x = 0.0248364*1000;
204 double pos21_y = 0.0129674*1000;
205 double pos21_z = -0.321989*1000;
206 FROG_Element_Event_Hit* hit21 = new FROG_Element_Event_Hit(400000001 + ((int)pos21_z)/50, pos21_x, pos21_y, pos21_z, -1);
207 track8->addDaughter(hit21);
208 double pos22_x = 0.0222521*1000;
209 double pos22_y = 0*1000;
210 double pos22_z = -0.319622*1000;
211 FROG_Element_Event_Hit* hit22 = new FROG_Element_Event_Hit(400000001 + ((int)pos22_z)/50, pos22_x, pos22_y, pos22_z, -1);
212 track8->addDaughter(hit22);
213 double pos23_x = 0.0141387*1000;
214 double pos23_y = -0.04071*1000;
215 double pos23_z = -0.312192*1000;
216 FROG_Element_Event_Hit* hit23 = new FROG_Element_Event_Hit(400000001 + ((int)pos23_z)/50, pos23_x, pos23_y, pos23_z, -1);
217 track8->addDaughter(hit23);
218 trackCollection->addDaughter(track8);
219
220 // photon 9
221 FROG_Element_Event_Track* track9 = new FROG_Element_Event_Track(0,1,1,0);
222 double pos24_x = 0.0299923*1000;
223 double pos24_y = 0.00602767*1000;
224 double pos24_z = -0.162889*1000;
225 FROG_Element_Event_Hit* hit24 = new FROG_Element_Event_Hit(400000001 + ((int)pos24_z)/50, pos24_x, pos24_y, pos24_z, -1);
226 track9->addDaughter(hit24);
227 double pos25_x = 0.0275782*1000;
228 double pos25_y = 0*1000;
229 double pos25_z = -0.266817*1000;
230 FROG_Element_Event_Hit* hit25 = new FROG_Element_Event_Hit(400000001 + ((int)pos25_z)/50, pos25_x, pos25_y, pos25_z, -1);
231 track9->addDaughter(hit25);
232 trackCollection->addDaughter(track9);
233
234 // photon 10
235 FROG_Element_Event_Track* track10 = new FROG_Element_Event_Track(0,1,1,0);
236 double pos26_x = 0.0299923*1000;
237 double pos26_y = 0.00602767*1000;
238 double pos26_z = -0.0968708*1000;
239 FROG_Element_Event_Hit* hit26 = new FROG_Element_Event_Hit(400000001 + ((int)pos26_z)/50, pos26_x, pos26_y, pos26_z, -1);
240 track10->addDaughter(hit26);
241 double pos27_x = 0.03*1000;
242 double pos27_y = 0.00603619*1000;
243 double pos27_z = -0.0970637*1000;
244 FROG_Element_Event_Hit* hit27 = new FROG_Element_Event_Hit(400000001 + ((int)pos27_z)/50, pos27_x, pos27_y, pos27_z, -1);
245 track10->addDaughter(hit27);
246 trackCollection->addDaughter(track10);
247
248 // photon 11
249 FROG_Element_Event_Track* track11 = new FROG_Element_Event_Track(0,1,1,0);
250 double pos28_x = 0.0299923*1000;
251 double pos28_y = 0.00602767*1000;
252 double pos28_z = -0.211734*1000;
253 FROG_Element_Event_Hit* hit28 = new FROG_Element_Event_Hit(400000001 + ((int)pos28_z)/50, pos28_x, pos28_y, pos28_z, -1);
254 track11->addDaughter(hit28);
255 double pos29_x = 0.0231748*1000;
256 double pos29_y = 0.00496626*1000;
257 double pos29_z = -0.328422*1000;
258 FROG_Element_Event_Hit* hit29 = new FROG_Element_Event_Hit(400000001 + ((int)pos29_z)/50, pos29_x, pos29_y, pos29_z, -1);
259 track11->addDaughter(hit29);
260 double pos30_x = 0.0221601*1000;
261 double pos30_y = 0*1000;
262 double pos30_z = -0.326734*1000;
263 FROG_Element_Event_Hit* hit30 = new FROG_Element_Event_Hit(400000001 + ((int)pos30_z)/50, pos30_x, pos30_y, pos30_z, -1);
264 track11->addDaughter(hit30);
265 double pos31_x = 0.0138423*1000;
266 double pos31_y = -0.04071*1000;
267 double pos31_z = -0.312897*1000;
268 FROG_Element_Event_Hit* hit31 = new FROG_Element_Event_Hit(400000001 + ((int)pos31_z)/50, pos31_x, pos31_y, pos31_z, -1);
269 track11->addDaughter(hit31);
270 trackCollection->addDaughter(track11);
271
272 // photon 12
273 FROG_Element_Event_Track* track12 = new FROG_Element_Event_Track(0,1,1,0);
274 double pos32_x = 0.0299923*1000;
275 double pos32_y = 0.00602767*1000;
276 double pos32_z = -0.233216*1000;
277 FROG_Element_Event_Hit* hit32 = new FROG_Element_Event_Hit(400000001 + ((int)pos32_z)/50, pos32_x, pos32_y, pos32_z, -1);
278 track12->addDaughter(hit32);
279 double pos33_x = 0.03*1000;
280 double pos33_y = 0.00603839*1000;
281 double pos33_z = -0.233429*1000;
282 FROG_Element_Event_Hit* hit33 = new FROG_Element_Event_Hit(400000001 + ((int)pos33_z)/50, pos33_x, pos33_y, pos33_z, -1);
283 track12->addDaughter(hit33);
284 trackCollection->addDaughter(track12);
285
286 // photon 13
287 FROG_Element_Event_Track* track13 = new FROG_Element_Event_Track(0,1,1,0);
288 double pos34_x = 0.0299923*1000;
289 double pos34_y = 0.00602767*1000;
290 double pos34_z = -0.0352209*1000;
291 FROG_Element_Event_Hit* hit34 = new FROG_Element_Event_Hit(400000001 + ((int)pos34_z)/50, pos34_x, pos34_y, pos34_z, -1);
292 track13->addDaughter(hit34);
293 double pos35_x = 0.03*1000;
294 double pos35_y = 0.00603501*1000;
295 double pos35_z = -0.0353909*1000;
296 FROG_Element_Event_Hit* hit35 = new FROG_Element_Event_Hit(400000001 + ((int)pos35_z)/50, pos35_x, pos35_y, pos35_z, -1);
297 track13->addDaughter(hit35);
298 trackCollection->addDaughter(track13);
299
300 // photon 14
301 FROG_Element_Event_Track* track14 = new FROG_Element_Event_Track(0,1,1,0);
302 double pos36_x = 0.0299923*1000;
303 double pos36_y = 0.00602767*1000;
304 double pos36_z = -0.0678788*1000;
305 FROG_Element_Event_Hit* hit36 = new FROG_Element_Event_Hit(400000001 + ((int)pos36_z)/50, pos36_x, pos36_y, pos36_z, -1);
306 track14->addDaughter(hit36);
307 double pos37_x = 0.03*1000;
308 double pos37_y = 0.00602573*1000;
309 double pos37_z = -0.0680089*1000;
310 FROG_Element_Event_Hit* hit37 = new FROG_Element_Event_Hit(400000001 + ((int)pos37_z)/50, pos37_x, pos37_y, pos37_z, -1);
311 track14->addDaughter(hit37);
312 trackCollection->addDaughter(track14);
313
314 // photon 15
315 FROG_Element_Event_Track* track15 = new FROG_Element_Event_Track(0,1,1,0);
316 double pos38_x = 0.0299923*1000;
317 double pos38_y = 0.00602767*1000;
318 double pos38_z = -0.0418564*1000;
319 FROG_Element_Event_Hit* hit38 = new FROG_Element_Event_Hit(400000001 + ((int)pos38_z)/50, pos38_x, pos38_y, pos38_z, -1);
320 track15->addDaughter(hit38);
321 double pos39_x = 0.0281432*1000;
322 double pos39_y = 0*1000;
323 double pos39_z = -0.148365*1000;
324 FROG_Element_Event_Hit* hit39 = new FROG_Element_Event_Hit(400000001 + ((int)pos39_z)/50, pos39_x, pos39_y, pos39_z, -1);
325 track15->addDaughter(hit39);
326 trackCollection->addDaughter(track15);
327 event1->addDaughter(trackCollectionP);
328 event1->addDaughter(trackCollection);
329
330}
331
332void FrogDisplay::BuidEvents(string outputfilename,int nEntryFrog)
333{
334 const Font_t kExRootFont = 42;
335 const Float_t kExRootFontSize = 0.07;
336 gROOT->SetStyle("Plain");
337 gROOT->cd();
338 gStyle->SetCanvasColor(10);
339 gStyle->SetPadColor(10);
340 gStyle->SetFillColor(-1);
341 gStyle->SetPaperSize(20, 24);
342 gStyle->SetStatFont(kExRootFont);
343 gStyle->SetTextFont(kExRootFont);
344 gStyle->SetTextSize(kExRootFontSize);
345 gStyle->SetLegendBorderSize(0);
346 gStyle->SetOptStat(0);
347
348 TChain* chain = new TChain("Analysis");
349 TChain* chainGen = new TChain("GEN");
350 chain ->Add(outputfilename.c_str());
351 chainGen->Add(outputfilename.c_str());
352
353 ExRootTreeReader *treeReader = new ExRootTreeReader(chain);
354 ExRootTreeReader *treeReaderGen = new ExRootTreeReader(chainGen);
355
356 const TClonesArray* branchElectron = treeReader ->UseBranch("Electron");
357 const TClonesArray* branchMuon = treeReader ->UseBranch("Muon");
358 const TClonesArray* branchTau = treeReader ->UseBranch("TauJet");
359 const TClonesArray* branchPhoton = treeReader ->UseBranch("Photon");
360 const TClonesArray* branchJet = treeReader ->UseBranch("Jet");
361 const TClonesArray* branchMET = treeReader ->UseBranch("ETmis");
362 const TClonesArray* branchTracks = treeReader ->UseBranch("Tracks");
363 const TClonesArray* particles = treeReaderGen->UseBranch("Particle");
364
365 TRootElectron* elec;
366 TRootMuon* muon;
367 TRootTauJet* tau;
368 TRootPhoton* photon;
369 TRootJet* jet;
370 TRootETmis* met;
371
372 Long64_t allEntries;
373 allEntries=treeReader->GetEntries();
374
375 FROG_Events* frog_events = new FROG_Events();
376 if(nEntryFrog > allEntries)
377 {
378 cout<<"nEntry to display by frog greater than number of available events... Exit"<<endl;
379 return;
380 }
381 for(Int_t entry = 0; entry < nEntryFrog; ++entry){
382 cout<<"Event n° "<<entry<<endl;
383 treeReader ->ReadEntry(entry);
384 treeReaderGen->ReadEntry(entry);
385
386 //Create a new event
387 FROG_Element_Event* frog_event = new FROG_Element_Event(1,entry);
388 frog_events->AddEvent(frog_event);
389
390 //Create a new branch in the event with name SIM and ID = EVTID_SIM
391 FROG_Element_Base_With_DetId_And_Name* frog_branchSIM = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM,"SIM");
392 frog_event->addDaughter(frog_branchSIM);
393
394 //SIM ELEC
395 //Create a new sub-branch in the SIM branch with name Electrons: this sub branch will contais all the electrons
396 FROG_Element_Base_With_DetId_And_Name* frog_branchElectrons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+1000,"Electrons");
397 frog_branchSIM->addDaughter(frog_branchElectrons);
398
399 for(int p=0;p<branchElectron->GetEntriesFast();p++){
400 elec = (TRootElectron*) branchElectron->At(p);
401 cout<<"Elec nO "<<p<<" PT: "<<elec->PT<<" Eta "<<elec->Eta<<" Phi"<<elec->Phi<<endl;
402 FROG_Element_Event_Candidate* frog_elec = new FROG_Element_Event_Candidate(11,elec->E,elec->Eta,elec->Phi);
403
404 frog_branchElectrons->addDaughter(frog_elec);
405 }
406
407 //SIM MUONS
408 //Create a new sub-branch in the SIM branch with name Muons: this sub branch will contais all the muons
409 FROG_Element_Base_With_DetId_And_Name* frog_branchMuons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+2000,"Muons");
410 frog_branchSIM->addDaughter(frog_branchMuons);
411 for(int p=0;p<branchMuon->GetEntriesFast();p++){
412 muon = (TRootMuon*) branchMuon->At(p);
413 cout<<"Muon nO"<<p<<" PT: "<<muon->PT<<"Eta "<<muon->Eta<<" Phi"<<muon->Phi<<endl;
414 FROG_Element_Event_Candidate* frog_muon = new FROG_Element_Event_Candidate(13,muon->E,muon->Eta,muon->Phi);
415 frog_branchMuons->addDaughter(frog_muon);
416 }
417
418 //SIM TAUS
419 //Create a new sub-branch in the SIM branch with name Taus: this sub branch will contais all the Taus
420 FROG_Element_Base_With_DetId_And_Name* frog_branchTaus = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+3000,"Taus");
421 frog_branchSIM->addDaughter(frog_branchTaus);
422 for(int p=0;p<branchTau->GetEntriesFast();p++){
423 tau = (TRootTauJet*) branchTau->At(p);
424 cout<<"Tau nO"<<p<<" PT: "<<tau->PT<<"Eta "<<tau->Eta<<" Phi"<<tau->Phi<<endl;
425 FROG_Element_Event_Candidate* frog_tau = new FROG_Element_Event_Candidate(15,tau->E,tau->Eta,tau->Phi);
426 frog_branchTaus->addDaughter(frog_tau);
427 }
428
429 //SIM PHOTONS
430 //Create a new sub-branch in the SIM branch with name Photons: this sub branch will contais all the Photons
431 FROG_Element_Base_With_DetId_And_Name* frog_branchPhotons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+4000,"Photons");
432 frog_branchSIM->addDaughter(frog_branchPhotons);
433 for(int p=0;p<branchPhoton->GetEntriesFast();p++){
434 photon = (TRootPhoton*) branchPhoton->At(p);
435 cout<<"Photon nO"<<p<<" PT: "<<photon->PT<<"Eta "<<photon->Eta<<" Phi"<<photon->Phi<<endl;
436 FROG_Element_Event_Candidate* frog_photon = new FROG_Element_Event_Candidate(15,photon->E,photon->Eta,photon->Phi);
437 frog_branchPhotons->addDaughter(frog_photon);
438 }
439
440 //SIM JETS
441 //Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the Jets
442 FROG_Element_Base_With_DetId_And_Name* frog_branchJets = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+5000,"Jets");
443 frog_branchSIM->addDaughter(frog_branchJets);
444 for(int p=0;p<branchJet->GetEntriesFast();p++){
445 jet = (TRootJet*) branchJet->At(p);
446 cout<<"Jet nO"<<p<<" PT: "<<jet->PT<<"Eta "<<jet->Eta<<" Phi"<<jet->Phi<<endl;
447 FROG_Element_Event_Jet* frog_jet = new FROG_Element_Event_Jet(jet->E,jet->Eta,jet->Phi);
448 frog_branchJets->addDaughter(frog_jet);
449 }
450
451 //SIM MET
452 //Create a new sub-branch in the SIM branch with name MET: this sub branch will contais all the METs
453 FROG_Element_Base_With_DetId_And_Name* frog_branchMET = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+6000,"MET");
454 frog_branchSIM->addDaughter(frog_branchMET);
455 for(int p=0;p<branchMET->GetEntriesFast();p++){
456 met = (TRootETmis*) branchMET->At(p);
457 cout<<"MET nO"<<p<<" ET: "<<met->ET<<"Eta "<<0<<" Phi"<<met->Phi<<endl;
458 FROG_Element_Event_MET* frog_met = new FROG_Element_Event_MET(0,met->ET,0,met->Phi, met->ET);
459 frog_branchMET->addDaughter(frog_met);
460 }
461
462 //Save the event in the .vis file
463 frog_events->SaveInLive("DelphesToFrog.vis",false,false,(unsigned int)-1);
464 }
465
466 delete treeReader;
467 delete treeReaderGen;
468 delete frog_events;
469}
470
471void FrogDisplay::BuildGeom(string DetDatacard)
472{
473 //Smearing information
474 RESOLution *DET = new RESOLution();
475 DET->ReadDataCard(DetDatacard);
476
477 // This element is the root of the "file" tree. (don't change this line)
478 FROG_Element_Base* prim = new FROG_Element_Base(C_PRIMARY);
479
480 FROG_Element_Base* mygeom = new FROG_Element_Base(C_GEOMETRY);
481 prim->addDaughter(mygeom);
482
483 FROG_Element_Base_With_DetId_And_Name* detector = new FROG_Element_Base_With_DetId_And_Name(900000000,"Delphes");
484 mygeom->addDaughter(detector);
485
486 double Rayon_Tracker=50;
487 double Rayon_Calo = Rayon_Tracker*2;
488 double Lenght_Tracker=120;
489 double Lenght_Calo=Lenght_Tracker+Lenght_Tracker/2;
490 double Lenght_FWCalo=Lenght_Tracker+Lenght_Tracker;
491
492 int NumPhi=10;
493
494 //************************************************Tracker*************************************************
495 //********************************************************************************************************
496
497 FROG_Element_Base_With_DetId_And_Name* Tracker = new FROG_Element_Base_With_DetId_And_Name(910000000,"Tracker");
498 detector->addDaughter(Tracker);
499 unsigned int DetIdCountTracker = 1;
500 for(double ray=0;ray <= Rayon_Tracker;ray +=5){
501 double length = ray/tan(EtaToTheta(DET->CEN_max_tracker));
502 if(length >= Lenght_Tracker)
503 {
504 FROG_Element_Primitive_Cylinder* tracker = new FROG_Element_Primitive_Cylinder(9100000+DetIdCountTracker*10,ray,0,0,0,0,0,Lenght_Tracker,NumPhi,0);
505 Tracker->addDaughter(tracker); DetIdCountTracker++;
506 }
507 else {
508 FROG_Element_Primitive_Cylinder* tracker = new FROG_Element_Primitive_Cylinder(9100000+DetIdCountTracker*10,ray,0,0,0,0,0,length,NumPhi,0);
509 Tracker->addDaughter(tracker); DetIdCountTracker++;
510 }
511 }
512
513 //******************************************Central calorimeters******************************************
514 //********************************************************************************************************
515
516 FROG_Element_Base_With_DetId_And_Name* CALO = new FROG_Element_Base_With_DetId_And_Name(920000000,"Calo");
517 detector->addDaughter(CALO);
518 unsigned int DetIdCountCalo = 1;
519
520 for(double ray=Rayon_Tracker;ray <= Rayon_Calo ;ray +=5){
521 double length = ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
522 double add;
523 if(length >= Lenght_Calo)add=Lenght_Calo;
524 else add=ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
525 if(add > 0)
526 {
527 FROG_Element_Primitive_Cylinder* calo = new FROG_Element_Primitive_Cylinder(9200000+DetIdCountCalo*10,ray,0,0,0,0,0,add,NumPhi,0);
528 CALO->addDaughter(calo); DetIdCountCalo++;
529 }
530 }
531 for(double ray=0;ray <= Rayon_Tracker;ray +=5){
532 double length = ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
533 double add;
534 if(length >= Lenght_Calo)add=(Lenght_Calo-Lenght_Tracker)/2;
535 else add=(length-Lenght_Tracker)/2;
536 if(add > 0)
537 {
538 FROG_Element_Primitive_Cylinder* caloP = new FROG_Element_Primitive_Cylinder(9200000+DetIdCountCalo*10,ray,0,0,(Lenght_Tracker+add)/2,0,0,add,NumPhi,0);
539 CALO->addDaughter(caloP); DetIdCountCalo++;
540 FROG_Element_Primitive_Cylinder* caloM = new FROG_Element_Primitive_Cylinder(9200000+DetIdCountCalo*10,ray,0,0,-(Lenght_Tracker+add)/2,0,0,add,NumPhi,0);
541 CALO->addDaughter(caloM); DetIdCountCalo++;
542 }
543 }
544
545 //******************************************Forward calorimeters******************************************
546 //********************************************************************************************************
547
548 FROG_Element_Base_With_DetId_And_Name* FWCALO = new FROG_Element_Base_With_DetId_And_Name(930000000,"FWCalo");
549 detector->addDaughter(FWCALO);
550 unsigned int DetIdCountFwCalo = 1;
551
552 double eta_Max=DET->CEN_max_calo_fwd,eta_Min=DET->CEN_max_calo_cen;
553
554 for(double ray=0;ray <= 50;ray +=5){
555 double length = ray/tan(EtaToTheta(eta_Max));
556 double add;
557 if(length >= Lenght_FWCalo)add=(Lenght_FWCalo-Lenght_Calo)/2;
558 else add=(length-Lenght_Calo)/2;
559
560 if(add > 0 && ray < Lenght_FWCalo*tan(EtaToTheta(eta_Min)))
561 {
562 FROG_Element_Primitive_Cylinder* caloFW1 = new FROG_Element_Primitive_Cylinder(9300000+DetIdCountFwCalo*10,ray,0,0,(Lenght_Calo+add)/2,0,0,add,NumPhi,0);
563 FWCALO->addDaughter(caloFW1); DetIdCountFwCalo++;
564 FROG_Element_Primitive_Cylinder* caloFW2 = new FROG_Element_Primitive_Cylinder(9300000+DetIdCountFwCalo*10,ray,0,0,-(Lenght_Calo+add)/2,0,0,add,NumPhi,0);
565 FWCALO->addDaughter(caloFW2); DetIdCountFwCalo++;
566 }
567 }
568
569 FROG_Geometry* CustomGeom = new FROG_Geometry(prim);
570 CustomGeom->Save("DelphesToFrog.geom");
571
572 FROG_ELEMENT::PrintTree(prim);
573 return;
574
575}
576
Note: See TracBrowser for help on using the repository browser.