Fork me on GitHub

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

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

remove comment

File size: 35.9 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
82
83 trackCollection->addDaughter(track1);
84 // photon 2
85 FROG_Element_Event_Track* track2 = new FROG_Element_Event_Track(0,1,1,0);
86 double pos2_x = 0.0299923*1000;
87 double pos2_y = 0.00602767*1000;
88 double pos2_z = -0.312795*1000;
89 FROG_Element_Event_Hit* hit2 = new FROG_Element_Event_Hit(400000001 + ((int)pos2_z)/50, pos2_x, pos2_y, pos2_z, -1);
90 track2->addDaughter(hit2);
91 double pos3_x = 0.0291312*1000;
92 double pos3_y = 0.00599684*1000;
93 double pos3_z = -0.326865*1000;
94 FROG_Element_Event_Hit* hit3 = new FROG_Element_Event_Hit(400000001 + ((int)pos3_z)/50, pos3_x, pos3_y, pos3_z, -1);
95 track2->addDaughter(hit3);
96 double pos4_x = 0.0272812*1000;
97 double pos4_y = 0*1000;
98 double pos4_z = -0.325133*1000;
99 FROG_Element_Event_Hit* hit4 = new FROG_Element_Event_Hit(400000001 + ((int)pos4_z)/50, pos4_x, pos4_y, pos4_z, -1);
100 track2->addDaughter(hit4);
101 double pos5_x = 0.0147219*1000;
102 double pos5_y = -0.04071*1000;
103 double pos5_z = -0.313375*1000;
104 FROG_Element_Event_Hit* hit5 = new FROG_Element_Event_Hit(400000001 + ((int)pos5_z)/50, pos5_x, pos5_y, pos5_z, -1);
105 track2->addDaughter(hit5);
106 trackCollection->addDaughter(track2);
107
108 // photon 3
109 FROG_Element_Event_Track* track3 = new FROG_Element_Event_Track(0,1,1,0);
110 double pos6_x = 0.0299923*1000;
111 double pos6_y = 0.00602767*1000;
112 double pos6_z = -0.241733*1000;
113 FROG_Element_Event_Hit* hit6 = new FROG_Element_Event_Hit(400000001 + ((int)pos6_z)/50, pos6_x, pos6_y, pos6_z, -1);
114 track3->addDaughter(hit6);
115 double pos7_x = 0.0247239*1000;
116 double pos7_y = 0.00635725*1000;
117 double pos7_z = -0.327258*1000;
118 FROG_Element_Event_Hit* hit7 = new FROG_Element_Event_Hit(400000001 + ((int)pos7_z)/50, pos7_x, pos7_y, pos7_z, -1);
119 track3->addDaughter(hit7);
120 double pos8_x = 0.023245*1000;
121 double pos8_y = 0*1000;
122 double pos8_z = -0.325292*1000;
123 FROG_Element_Event_Hit* hit8 = new FROG_Element_Event_Hit(400000001 + ((int)pos8_z)/50, pos8_x, pos8_y, pos8_z, -1);
124 track3->addDaughter(hit8);
125 double pos9_x = 0.0137742*1000;
126 double pos9_y = -0.04071*1000;
127 double pos9_z = -0.312698*1000;
128 FROG_Element_Event_Hit* hit9 = new FROG_Element_Event_Hit(400000001 + ((int)pos9_z)/50, pos9_x, pos9_y, pos9_z, -1);
129 track3->addDaughter(hit9);
130 trackCollection->addDaughter(track3);
131
132 // photon 4
133 FROG_Element_Event_Track* track4 = new FROG_Element_Event_Track(0,1,1,0);
134 double pos10_x = 0.0299923*1000;
135 double pos10_y = 0.00602767*1000;
136 double pos10_z = -0.103114*1000;
137 FROG_Element_Event_Hit* hit10 = new FROG_Element_Event_Hit(400000001 + ((int)pos10_z)/50, pos10_x, pos10_y, pos10_z, -1);
138 track4->addDaughter(hit10);
139 double pos11_x = 0.0169713*1000;
140 double pos11_y = 0.0106604*1000;
141 double pos11_z = -0.324528*1000;
142 FROG_Element_Event_Hit* hit11 = new FROG_Element_Event_Hit(400000001 + ((int)pos11_z)/50, pos11_x, pos11_y, pos11_z, -1);
143 track4->addDaughter(hit11);
144 double pos12_x = 0.0159847*1000;
145 double pos12_y = 0*1000;
146 double pos12_z = -0.322034*1000;
147 FROG_Element_Event_Hit* hit12 = new FROG_Element_Event_Hit(400000001 + ((int)pos12_z)/50, pos12_x, pos12_y, pos12_z, -1);
148 track4->addDaughter(hit12);
149 double pos13_x = 0.00925296*1000;
150 double pos13_y = -0.0727334*1000;
151 double pos13_z = -0.305018*1000;
152 FROG_Element_Event_Hit* hit13 = new FROG_Element_Event_Hit(400000001 + ((int)pos13_z)/50, pos13_x, pos13_y, pos13_z, -1);
153 track4->addDaughter(hit13);
154 trackCollection->addDaughter(track4);
155
156 // photon 5
157 FROG_Element_Event_Track* track5 = new FROG_Element_Event_Track(0,1,1,0);
158 double pos14_x = 0.0299923*1000;
159 double pos14_y = 0.00602767*1000;
160 double pos14_z = -0.0550703*1000;
161 FROG_Element_Event_Hit* hit14 = new FROG_Element_Event_Hit(400000001 + ((int)pos14_z)/50, pos14_x, pos14_y, pos14_z, -1);
162 track5->addDaughter(hit14);
163 double pos15_x = 0.03*1000;
164 double pos15_y = 0.00597767*1000;
165 double pos15_z = -0.0558923*1000;
166 FROG_Element_Event_Hit* hit15 = new FROG_Element_Event_Hit(400000001 + ((int)pos15_z)/50, pos15_x, pos15_y, pos15_z, -1);
167 track5->addDaughter(hit15);
168 trackCollection->addDaughter(track5);
169
170 // photon 6
171 FROG_Element_Event_Track* track6 = new FROG_Element_Event_Track(0,1,1,0);
172 double pos16_x = 0.0299923*1000;
173 double pos16_y = 0.00602767*1000;
174 double pos16_z = -0.0724158*1000;
175 FROG_Element_Event_Hit* hit16 = new FROG_Element_Event_Hit(400000001 + ((int)pos16_z)/50, pos16_x, pos16_y, pos16_z, -1);
176 track6->addDaughter(hit16);
177 double pos17_x = 0.03*1000;
178 double pos17_y = 0.00602949*1000;
179 double pos17_z = -0.0725471*1000;
180 FROG_Element_Event_Hit* hit17 = new FROG_Element_Event_Hit(400000001 + ((int)pos17_z)/50, pos17_x, pos17_y, pos17_z, -1);
181 track6->addDaughter(hit17);
182 trackCollection->addDaughter(track6);
183
184 // photon 7
185 FROG_Element_Event_Track* track7 = new FROG_Element_Event_Track(0,1,1,0);
186 double pos18_x = 0.0299923*1000;
187 double pos18_y = 0.00602767*1000;
188 double pos18_z = -0.108963*1000;
189 FROG_Element_Event_Hit* hit18 = new FROG_Element_Event_Hit(400000001 + ((int)pos18_z)/50, pos18_x, pos18_y, pos18_z, -1);
190 track7->addDaughter(hit18);
191 double pos19_x = 0.03*1000;
192 double pos19_y = 0.0060305*1000;
193 double pos19_z = -0.109102*1000;
194 FROG_Element_Event_Hit* hit19 = new FROG_Element_Event_Hit(400000001 + ((int)pos19_z)/50, pos19_x, pos19_y, pos19_z, -1);
195 track7->addDaughter(hit19);
196 trackCollection->addDaughter(track7);
197
198 // photon 8
199 FROG_Element_Event_Track* track8 = new FROG_Element_Event_Track(0,1,1,0);
200 double pos20_x = 0.0299923*1000;
201 double pos20_y = 0.00602767*1000;
202 double pos20_z = -0.189456*1000;
203 FROG_Element_Event_Hit* hit20 = new FROG_Element_Event_Hit(400000001 + ((int)pos20_z)/50, pos20_x, pos20_y, pos20_z, -1);
204 track8->addDaughter(hit20);
205 double pos21_x = 0.0248364*1000;
206 double pos21_y = 0.0129674*1000;
207 double pos21_z = -0.321989*1000;
208 FROG_Element_Event_Hit* hit21 = new FROG_Element_Event_Hit(400000001 + ((int)pos21_z)/50, pos21_x, pos21_y, pos21_z, -1);
209 track8->addDaughter(hit21);
210 double pos22_x = 0.0222521*1000;
211 double pos22_y = 0*1000;
212 double pos22_z = -0.319622*1000;
213 FROG_Element_Event_Hit* hit22 = new FROG_Element_Event_Hit(400000001 + ((int)pos22_z)/50, pos22_x, pos22_y, pos22_z, -1);
214 track8->addDaughter(hit22);
215 double pos23_x = 0.0141387*1000;
216 double pos23_y = -0.04071*1000;
217 double pos23_z = -0.312192*1000;
218 FROG_Element_Event_Hit* hit23 = new FROG_Element_Event_Hit(400000001 + ((int)pos23_z)/50, pos23_x, pos23_y, pos23_z, -1);
219 track8->addDaughter(hit23);
220 trackCollection->addDaughter(track8);
221
222 // photon 9
223 FROG_Element_Event_Track* track9 = new FROG_Element_Event_Track(0,1,1,0);
224 double pos24_x = 0.0299923*1000;
225 double pos24_y = 0.00602767*1000;
226 double pos24_z = -0.162889*1000;
227 FROG_Element_Event_Hit* hit24 = new FROG_Element_Event_Hit(400000001 + ((int)pos24_z)/50, pos24_x, pos24_y, pos24_z, -1);
228 track9->addDaughter(hit24);
229 double pos25_x = 0.0275782*1000;
230 double pos25_y = 0*1000;
231 double pos25_z = -0.266817*1000;
232 FROG_Element_Event_Hit* hit25 = new FROG_Element_Event_Hit(400000001 + ((int)pos25_z)/50, pos25_x, pos25_y, pos25_z, -1);
233 track9->addDaughter(hit25);
234 trackCollection->addDaughter(track9);
235
236 // photon 10
237 FROG_Element_Event_Track* track10 = new FROG_Element_Event_Track(0,1,1,0);
238 double pos26_x = 0.0299923*1000;
239 double pos26_y = 0.00602767*1000;
240 double pos26_z = -0.0968708*1000;
241 FROG_Element_Event_Hit* hit26 = new FROG_Element_Event_Hit(400000001 + ((int)pos26_z)/50, pos26_x, pos26_y, pos26_z, -1);
242 track10->addDaughter(hit26);
243 double pos27_x = 0.03*1000;
244 double pos27_y = 0.00603619*1000;
245 double pos27_z = -0.0970637*1000;
246 FROG_Element_Event_Hit* hit27 = new FROG_Element_Event_Hit(400000001 + ((int)pos27_z)/50, pos27_x, pos27_y, pos27_z, -1);
247 track10->addDaughter(hit27);
248 trackCollection->addDaughter(track10);
249
250 // photon 11
251 FROG_Element_Event_Track* track11 = new FROG_Element_Event_Track(0,1,1,0);
252 double pos28_x = 0.0299923*1000;
253 double pos28_y = 0.00602767*1000;
254 double pos28_z = -0.211734*1000;
255 FROG_Element_Event_Hit* hit28 = new FROG_Element_Event_Hit(400000001 + ((int)pos28_z)/50, pos28_x, pos28_y, pos28_z, -1);
256 track11->addDaughter(hit28);
257 double pos29_x = 0.0231748*1000;
258 double pos29_y = 0.00496626*1000;
259 double pos29_z = -0.328422*1000;
260 FROG_Element_Event_Hit* hit29 = new FROG_Element_Event_Hit(400000001 + ((int)pos29_z)/50, pos29_x, pos29_y, pos29_z, -1);
261 track11->addDaughter(hit29);
262 double pos30_x = 0.0221601*1000;
263 double pos30_y = 0*1000;
264 double pos30_z = -0.326734*1000;
265 FROG_Element_Event_Hit* hit30 = new FROG_Element_Event_Hit(400000001 + ((int)pos30_z)/50, pos30_x, pos30_y, pos30_z, -1);
266 track11->addDaughter(hit30);
267 double pos31_x = 0.0138423*1000;
268 double pos31_y = -0.04071*1000;
269 double pos31_z = -0.312897*1000;
270 FROG_Element_Event_Hit* hit31 = new FROG_Element_Event_Hit(400000001 + ((int)pos31_z)/50, pos31_x, pos31_y, pos31_z, -1);
271 track11->addDaughter(hit31);
272 trackCollection->addDaughter(track11);
273
274 // photon 12
275 FROG_Element_Event_Track* track12 = new FROG_Element_Event_Track(0,1,1,0);
276 double pos32_x = 0.0299923*1000;
277 double pos32_y = 0.00602767*1000;
278 double pos32_z = -0.233216*1000;
279 FROG_Element_Event_Hit* hit32 = new FROG_Element_Event_Hit(400000001 + ((int)pos32_z)/50, pos32_x, pos32_y, pos32_z, -1);
280 track12->addDaughter(hit32);
281 double pos33_x = 0.03*1000;
282 double pos33_y = 0.00603839*1000;
283 double pos33_z = -0.233429*1000;
284 FROG_Element_Event_Hit* hit33 = new FROG_Element_Event_Hit(400000001 + ((int)pos33_z)/50, pos33_x, pos33_y, pos33_z, -1);
285 track12->addDaughter(hit33);
286 trackCollection->addDaughter(track12);
287
288 // photon 13
289 FROG_Element_Event_Track* track13 = new FROG_Element_Event_Track(0,1,1,0);
290 double pos34_x = 0.0299923*1000;
291 double pos34_y = 0.00602767*1000;
292 double pos34_z = -0.0352209*1000;
293 FROG_Element_Event_Hit* hit34 = new FROG_Element_Event_Hit(400000001 + ((int)pos34_z)/50, pos34_x, pos34_y, pos34_z, -1);
294 track13->addDaughter(hit34);
295 double pos35_x = 0.03*1000;
296 double pos35_y = 0.00603501*1000;
297 double pos35_z = -0.0353909*1000;
298 FROG_Element_Event_Hit* hit35 = new FROG_Element_Event_Hit(400000001 + ((int)pos35_z)/50, pos35_x, pos35_y, pos35_z, -1);
299 track13->addDaughter(hit35);
300 trackCollection->addDaughter(track13);
301
302 // photon 14
303 FROG_Element_Event_Track* track14 = new FROG_Element_Event_Track(0,1,1,0);
304 double pos36_x = 0.0299923*1000;
305 double pos36_y = 0.00602767*1000;
306 double pos36_z = -0.0678788*1000;
307 FROG_Element_Event_Hit* hit36 = new FROG_Element_Event_Hit(400000001 + ((int)pos36_z)/50, pos36_x, pos36_y, pos36_z, -1);
308 track14->addDaughter(hit36);
309 double pos37_x = 0.03*1000;
310 double pos37_y = 0.00602573*1000;
311 double pos37_z = -0.0680089*1000;
312 FROG_Element_Event_Hit* hit37 = new FROG_Element_Event_Hit(400000001 + ((int)pos37_z)/50, pos37_x, pos37_y, pos37_z, -1);
313 track14->addDaughter(hit37);
314 trackCollection->addDaughter(track14);
315
316 // photon 15
317 FROG_Element_Event_Track* track15 = new FROG_Element_Event_Track(0,1,1,0);
318 double pos38_x = 0.0299923*1000;
319 double pos38_y = 0.00602767*1000;
320 double pos38_z = -0.0418564*1000;
321 FROG_Element_Event_Hit* hit38 = new FROG_Element_Event_Hit(400000001 + ((int)pos38_z)/50, pos38_x, pos38_y, pos38_z, -1);
322 track15->addDaughter(hit38);
323 double pos39_x = 0.0281432*1000;
324 double pos39_y = 0*1000;
325 double pos39_z = -0.148365*1000;
326 FROG_Element_Event_Hit* hit39 = new FROG_Element_Event_Hit(400000001 + ((int)pos39_z)/50, pos39_x, pos39_y, pos39_z, -1);
327 track15->addDaughter(hit39);
328 trackCollection->addDaughter(track15);
329 event1->addDaughter(trackCollectionP);
330 event1->addDaughter(trackCollection);
331
332}
333
334void FrogDisplay::BuidEvents(string outputfilename,int nEntryFrog)
335{
336 const Font_t kExRootFont = 42;
337 const Float_t kExRootFontSize = 0.07;
338 gROOT->SetStyle("Plain");
339 gROOT->cd();
340 gStyle->SetCanvasColor(10);
341 gStyle->SetPadColor(10);
342 gStyle->SetFillColor(-1);
343 gStyle->SetPaperSize(20, 24);
344 gStyle->SetStatFont(kExRootFont);
345 gStyle->SetTextFont(kExRootFont);
346 gStyle->SetTextSize(kExRootFontSize);
347 gStyle->SetLegendBorderSize(0);
348 gStyle->SetOptStat(0);
349
350 TChain* chain = new TChain("Analysis");
351 TChain* chainGen = new TChain("GEN");
352 chain ->Add(outputfilename.c_str());
353 chainGen->Add(outputfilename.c_str());
354
355 ExRootTreeReader *treeReader = new ExRootTreeReader(chain);
356 ExRootTreeReader *treeReaderGen = new ExRootTreeReader(chainGen);
357
358 const TClonesArray* branchElectron = treeReader ->UseBranch("Electron");
359 const TClonesArray* branchMuon = treeReader ->UseBranch("Muon");
360 const TClonesArray* branchTau = treeReader ->UseBranch("TauJet");
361 const TClonesArray* branchPhoton = treeReader ->UseBranch("Photon");
362 const TClonesArray* branchJet = treeReader ->UseBranch("Jet");
363 const TClonesArray* branchMET = treeReader ->UseBranch("ETmis");
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
388 FROG_Element_Event* frog_event = new FROG_Element_Event(1,entry);
389 frog_events->AddEvent(frog_event);
390
391 //Create a new branch in the event with name SIM and ID = EVTID_SIM
392 FROG_Element_Base_With_DetId_And_Name* frog_branchSIM = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM,"SIM");
393 frog_event->addDaughter(frog_branchSIM);
394
395 //SIM ELEC
396 //Create a new sub-branch in the SIM branch with name Electrons: this sub branch will contais all the electrons
397 FROG_Element_Base_With_DetId_And_Name* frog_branchElectrons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+1000,"Electrons");
398 frog_branchSIM->addDaughter(frog_branchElectrons);
399
400 for(int p=0;p<branchElectron->GetEntriesFast();p++){
401 elec = (TRootElectron*) branchElectron->At(p);
402 cout<<"Elec nO "<<p<<" PT: "<<elec->PT<<" Eta "<<elec->Eta<<" Phi"<<elec->Phi<<endl;
403 FROG_Element_Event_Candidate* frog_elec = new FROG_Element_Event_Candidate(11,elec->E,elec->Eta,elec->Phi);
404
405 frog_branchElectrons->addDaughter(frog_elec);
406 }
407
408 //SIM MUONS
409 //Create a new sub-branch in the SIM branch with name Muons: this sub branch will contais all the muons
410 FROG_Element_Base_With_DetId_And_Name* frog_branchMuons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+2000,"Muons");
411 frog_branchSIM->addDaughter(frog_branchMuons);
412 for(int p=0;p<branchMuon->GetEntriesFast();p++){
413 muon = (TRootMuon*) branchMuon->At(p);
414 cout<<"Muon nO"<<p<<" PT: "<<muon->PT<<"Eta "<<muon->Eta<<" Phi"<<muon->Phi<<endl;
415 FROG_Element_Event_Candidate* frog_muon = new FROG_Element_Event_Candidate(13,muon->E,muon->Eta,muon->Phi);
416 frog_branchMuons->addDaughter(frog_muon);
417 }
418
419 //SIM TAUS
420 //Create a new sub-branch in the SIM branch with name Taus: this sub branch will contais all the Taus
421 FROG_Element_Base_With_DetId_And_Name* frog_branchTaus = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+3000,"Taus");
422 frog_branchSIM->addDaughter(frog_branchTaus);
423 for(int p=0;p<branchTau->GetEntriesFast();p++){
424 tau = (TRootTauJet*) branchTau->At(p);
425 cout<<"Tau nO"<<p<<" PT: "<<tau->PT<<"Eta "<<tau->Eta<<" Phi"<<tau->Phi<<endl;
426 FROG_Element_Event_Candidate* frog_tau = new FROG_Element_Event_Candidate(15,tau->E,tau->Eta,tau->Phi);
427 frog_branchTaus->addDaughter(frog_tau);
428 }
429
430 //SIM PHOTONS
431 //Create a new sub-branch in the SIM branch with name Photons: this sub branch will contais all the Photons
432 FROG_Element_Base_With_DetId_And_Name* frog_branchPhotons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+4000,"Photons");
433 frog_branchSIM->addDaughter(frog_branchPhotons);
434 for(int p=0;p<branchPhoton->GetEntriesFast();p++){
435 photon = (TRootPhoton*) branchPhoton->At(p);
436 cout<<"Photon nO"<<p<<" PT: "<<photon->PT<<"Eta "<<photon->Eta<<" Phi"<<photon->Phi<<endl;
437 FROG_Element_Event_Candidate* frog_photon = new FROG_Element_Event_Candidate(22,photon->E,photon->Eta,photon->Phi);
438 frog_branchPhotons->addDaughter(frog_photon);
439 }
440
441 //SIM JETS
442 //Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the Jets
443 FROG_Element_Base_With_DetId_And_Name* frog_branchJets = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+5000,"Jets");
444 frog_branchSIM->addDaughter(frog_branchJets);
445 for(int p=0;p<branchJet->GetEntriesFast();p++){
446 jet = (TRootJet*) branchJet->At(p);
447 cout<<"Jet nO"<<p<<" PT: "<<jet->PT<<"Eta "<<jet->Eta<<" Phi"<<jet->Phi<<endl;
448 FROG_Element_Event_Jet* frog_jet = new FROG_Element_Event_Jet(jet->E,jet->Eta,jet->Phi);
449 frog_branchJets->addDaughter(frog_jet);
450 }
451
452 //SIM MET
453 //Create a new sub-branch in the SIM branch with name MET: this sub branch will contais all the METs
454 FROG_Element_Base_With_DetId_And_Name* frog_branchMET = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+6000,"MET");
455 frog_branchSIM->addDaughter(frog_branchMET);
456 for(int p=0;p<branchMET->GetEntriesFast();p++){
457 met = (TRootETmis*) branchMET->At(p);
458 cout<<"MET nO"<<p<<" ET: "<<met->ET<<"Eta "<<0<<" Phi"<<met->Phi<<endl;
459 FROG_Element_Event_MET* frog_met = new FROG_Element_Event_MET(0,met->ET,0,met->Phi, met->ET);
460 frog_branchMET->addDaughter(frog_met);
461 }
462
463 //Save the event in the .vis file
464 frog_events->SaveInLive("DelphesToFrog.vis",false,false,(unsigned int)-1);
465 }
466
467 delete treeReader;
468 delete treeReaderGen;
469 delete frog_events;
470}
471
472void FrogDisplay::BuildGeom(string DetDatacard)
473{
474 //Smearing information
475 RESOLution *DET = new RESOLution();
476 DET->ReadDataCard(DetDatacard);
477
478 // This element is the root of the "file" tree. (don't change this line)
479 FROG_Element_Base* prim = new FROG_Element_Base(C_PRIMARY);
480
481 FROG_Element_Base* mygeom = new FROG_Element_Base(C_GEOMETRY);
482 prim->addDaughter(mygeom);
483
484 FROG_Element_Base_With_DetId_And_Name* detector = new FROG_Element_Base_With_DetId_And_Name(900000000,"Delphes");
485 mygeom->addDaughter(detector);
486
487 double Rayon_Tracker=40;
488 double Rayon_Calo = Rayon_Tracker*1.5;
489 double Rayon_Muon = Rayon_Tracker*2;
490 double Lenght_Tracker=100;
491 double Lenght_Calo=Lenght_Tracker+Lenght_Tracker/2.5;
492 double Lenght_Muon=Lenght_Calo+Lenght_Calo/2.5;
493 double Lenght_CaloFwd=Lenght_Muon+Lenght_Muon/2.5;
494
495 int NumPhi=100;
496 float frac=1;
497
498 //************************************************Tracker*************************************************
499 //********************************************************************************************************
500
501 FROG_Element_Base_With_DetId_And_Name* Tracker = new FROG_Element_Base_With_DetId_And_Name(910000000,"Tracker");
502 detector->addDaughter(Tracker);
503 unsigned int DetIdCountTracker = 1;
504
505 double ray=Rayon_Tracker;
506 double rayCone = tan(EtaToTheta(DET->CEN_max_tracker))*Lenght_Tracker/2;
507 if(ray < rayCone)ray=rayCone;
508
509 double dphi = 6.283185307179586476925286766559 /NumPhi;
510 for(double phi=0; phi<=6.2831/frac;phi+=dphi){
511
512 FROG_Element_Primitive_CustomSurface* trackerCone1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
513 rayCone*sin(phi) ,rayCone*cos(phi) ,-Lenght_Tracker/2,
514 rayCone*sin(phi+dphi) ,rayCone*cos(phi+dphi) ,-Lenght_Tracker/2,
515 0 , 0 , 0,
516 0 , 0 , 0
517 );
518
519 Tracker->addDaughter(trackerCone1); DetIdCountTracker++;
520
521 FROG_Element_Primitive_CustomSurface* trackerCone2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
522 0 , 0 ,0,
523 0 , 0 ,0,
524 rayCone*sin(phi) , rayCone*cos(phi) , Lenght_Tracker/2,
525 rayCone*sin(phi+dphi) , rayCone*sin(phi+dphi) , Lenght_Tracker/2
526 );
527 Tracker->addDaughter(trackerCone2); DetIdCountTracker++;
528
529
530 FROG_Element_Primitive_CustomSurface* trackerB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
531 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Tracker*0.5,
532 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Tracker*0.5,
533 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Tracker*0.5,
534 ray*sin(phi) ,ray*cos(phi) , Lenght_Tracker*0.5);
535
536 Tracker->addDaughter(trackerB); DetIdCountTracker++;
537
538 FROG_Element_Primitive_CustomSurface* trackerEndCap1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
539 rayCone*sin(phi) , rayCone*cos(phi) , -(Lenght_Tracker)/2,
540 rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , -(Lenght_Tracker)/2,
541 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Tracker)/2,
542 ray*sin(phi) , ray*cos(phi) , -(Lenght_Tracker)/2
543 );
544 Tracker->addDaughter(trackerEndCap1); DetIdCountTracker++;
545
546 FROG_Element_Primitive_CustomSurface* trackerEndCap2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
547 rayCone*sin(phi) , rayCone*cos(phi) , (Lenght_Tracker)/2,
548 rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , (Lenght_Tracker)/2,
549 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Tracker)/2,
550 ray*sin(phi) , ray*cos(phi) , (Lenght_Tracker)/2
551 );
552 Tracker->addDaughter(trackerEndCap2); DetIdCountTracker++;
553
554 }
555
556 Rayon_Calo = ray*1.5;
557
558 //******************************************Central calorimeters******************************************
559 //********************************************************************************************************
560
561 FROG_Element_Base_With_DetId_And_Name* CALO = new FROG_Element_Base_With_DetId_And_Name(920000000,"Calo");
562 detector->addDaughter(CALO);
563 unsigned int DetIdCountCalo = 1;
564
565 float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Tracker/2;
566 float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Calo/2;
567 ray=Rayon_Calo;
568 if(ray<rayConeF)ray=rayConeF;
569
570 for(double phi=0; phi<=6.2831/frac;phi+=dphi){
571
572 //BARREL
573 FROG_Element_Primitive_CustomSurface* caloB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountCalo*10,
574 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Calo*0.5,
575 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Calo*0.5,
576 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Calo*0.5,
577 ray*sin(phi) ,ray*cos(phi) , Lenght_Calo*0.5
578 );
579
580 CALO->addDaughter(caloB); DetIdCountCalo++;
581
582 //Partial cone + side
583 FROG_Element_Primitive_CustomSurface* caloEndCap1a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
584 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Tracker)/2,
585 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Tracker)/2,
586 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2,
587 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2
588 );
589 CALO->addDaughter(caloEndCap1a); DetIdCountCalo++;
590
591 //Close Endcap + side
592 FROG_Element_Primitive_CustomSurface* caloEndCap1b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
593 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2,
594 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2,
595 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Calo)/2,
596 ray*sin(phi) , ray*cos(phi) , (Lenght_Calo)/2
597 );
598 CALO->addDaughter(caloEndCap1b); DetIdCountCalo++;
599
600 //Partial cone - side
601 FROG_Element_Primitive_CustomSurface* caloEndCap2a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
602 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Tracker)/2,
603 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Tracker)/2,
604 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2,
605 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2
606 );
607 CALO->addDaughter(caloEndCap2a); DetIdCountCalo++;
608
609 //Close Endcap - side
610 FROG_Element_Primitive_CustomSurface* caloEndCap2b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
611 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2,
612 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2,
613 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Calo)/2,
614 ray*sin(phi) , ray*cos(phi) , -(Lenght_Calo)/2
615 );
616 CALO->addDaughter(caloEndCap2b); DetIdCountCalo++;
617
618 }
619
620 Rayon_Muon = ray*1.2;
621
622 //***********************************************Muon chambers********************************************
623 //********************************************************************************************************
624
625 FROG_Element_Base_With_DetId_And_Name* MUON = new FROG_Element_Base_With_DetId_And_Name(930000000,"Muon");
626 detector->addDaughter(MUON);
627 unsigned int DetIdCountMuon = 1;
628
629 rayConeD = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Calo/2;
630 rayConeF = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Muon/2;
631 ray=Rayon_Muon;
632 if(ray<rayConeF)ray=rayConeF;
633
634 for(double phi=0; phi<=6.2831/frac;phi+=dphi){
635
636 //BARREL
637 FROG_Element_Primitive_CustomSurface* muonB = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
638 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Muon*0.5,
639 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Muon*0.5,
640 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5,
641 ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5);
642
643 MUON->addDaughter(muonB); DetIdCountMuon++;
644
645 //Partial cone + side
646 FROG_Element_Primitive_CustomSurface* muonEndCap1a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
647 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Calo)/2,
648 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Calo)/2,
649 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2,
650 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2
651 );
652 MUON->addDaughter(muonEndCap1a); DetIdCountMuon++;
653
654 //Close Endcap + side
655 FROG_Element_Primitive_CustomSurface* muonEndCap1b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
656 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2,
657 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2,
658 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Muon)/2,
659 ray*sin(phi) , ray*cos(phi) , (Lenght_Muon)/2
660 );
661 MUON->addDaughter(muonEndCap1b); DetIdCountMuon++;
662
663 //Partial cone - side
664 FROG_Element_Primitive_CustomSurface* muonEndCap2a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
665 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Calo)/2,
666 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Calo)/2,
667 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2,
668 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2
669 );
670 MUON->addDaughter(muonEndCap2a); DetIdCountMuon++;
671
672 //Close Endcap - side
673 FROG_Element_Primitive_CustomSurface* muonEndCap2b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
674 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2,
675 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2,
676 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Muon)/2,
677 ray*sin(phi) , ray*cos(phi) , -(Lenght_Muon)/2
678 );
679 MUON->addDaughter(muonEndCap2b); DetIdCountMuon++;
680
681 }
682
683
684 //******************************************Forward calorimeters******************************************
685 //********************************************************************************************************
686
687 FROG_Element_Base_With_DetId_And_Name* CALOFWD = new FROG_Element_Base_With_DetId_And_Name(940000000,"CaloFwd");
688 detector->addDaughter(CALOFWD);
689 unsigned int DetIdCountCaloFwd = 1;
690
691 rayConeD = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_Muon;
692 rayConeF = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_CaloFwd;
693 ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd;
694
695 for(double phi=0; phi<=6.2831/frac;phi+=dphi){
696
697
698 //Partial cone + side
699 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
700 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Muon)/2,
701 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Muon)/2,
702 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2,
703 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2
704 );
705 CALOFWD->addDaughter(caloFWDEndCap1a); DetIdCountCaloFwd++;
706
707 //Close Endcap + side
708 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
709 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2,
710 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2,
711 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_CaloFwd)/2,
712 ray*sin(phi) , ray*cos(phi) , (Lenght_CaloFwd)/2
713 );
714 CALOFWD->addDaughter(caloFWDEndCap1b); DetIdCountCaloFwd++;
715
716 //BARREL
717 FROG_Element_Primitive_CustomSurface* caloFWDB1 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
718 ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5,
719 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5,
720 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_CaloFwd*0.5,
721 ray*sin(phi) ,ray*cos(phi) , Lenght_CaloFwd*0.5);
722
723 CALOFWD->addDaughter(caloFWDB1); DetIdCountCaloFwd++;
724
725
726
727
728 //Partial cone - side
729 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
730 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Muon)/2,
731 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Muon)/2,
732 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
733 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2
734 );
735 CALOFWD->addDaughter(caloFWDEndCap2a); DetIdCountCaloFwd++;
736
737 //Close Endcap - side
738 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
739 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2,
740 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
741 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
742 ray*sin(phi) , ray*cos(phi) , -(Lenght_CaloFwd)/2);
743
744 CALOFWD->addDaughter(caloFWDEndCap2b); DetIdCountCaloFwd++;
745
746 //BARREL
747 FROG_Element_Primitive_CustomSurface* caloFWDB2 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
748 ray*sin(phi) ,ray*cos(phi) , -Lenght_Muon*0.5,
749 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_Muon*0.5,
750 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_CaloFwd*0.5,
751 ray*sin(phi) ,ray*cos(phi) , -Lenght_CaloFwd*0.5);
752
753 CALOFWD->addDaughter(caloFWDB2); DetIdCountCaloFwd++;
754
755 }
756
757
758
759
760 FROG_Geometry* CustomGeom = new FROG_Geometry(prim);
761 CustomGeom->Save("DelphesToFrog.geom");
762
763 FROG_ELEMENT::PrintTree(prim);
764 return;
765
766}
767
Note: See TracBrowser for help on using the repository browser.