Fork me on GitHub

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

Last change on this file since 459 was 443, checked in by Xavier Rouby, 15 years ago

new header in all files

File size: 24.2 KB
Line 
1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \------------- arXiv:0903.2225v1 ------------/ **
7** **
8** **
9** This package uses: **
10** ------------------ **
11** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 **
12** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
13** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
14** FROG: [hep-ex/0901.2718v1] **
15** HepMC: Comput. Phys. Commun.134 (2001) 41 **
16** **
17** ------------------------------------------------------------------ **
18** **
19** Main authors: **
20** ------------- **
21** **
22** Severine Ovyn Xavier Rouby **
23** severine.ovyn@uclouvain.be xavier.rouby@cern **
24** **
25** Center for Particle Physics and Phenomenology (CP3) **
26** Universite catholique de Louvain (UCL) **
27** Louvain-la-Neuve, Belgium **
28** **
29** Copyright (C) 2008-2009, **
30** All rights reserved. **
31** **
32***********************************************************************/
33
34#include <iostream>
35
36#include "TROOT.h"
37#include "TApplication.h"
38#include "TStyle.h"
39#include "TChain.h"
40#include "TClonesArray.h"
41
42#include "BlockClasses.h"
43#include "ExRootTreeReader.h"
44#include "FrogUtil.h"
45
46#include "FROG_Coord.h"
47#include "FROG_Coord.cpp"
48#include "FROG_Geometry.h"
49#include "FROG_Geometry.cpp"
50#include "FROG_DetId.h"
51#include "FROG_Events.h"
52#include "FROG_Events.cpp"
53#include "FROG_Element_Tools.h"
54#include "FROG_Element_Tools.cpp"
55#include "FROG_Net_Tools.h"
56#include "FROG_Net_Tools.cpp"
57#include "FROG_Path.h"
58#include "FROG_Path.cpp"
59#include "FROG_ReadCards.h"
60#include "FROG_ReadCards.cpp"
61#include "FROG_ZLib.h"
62#include "FROG_ZLib.cpp"
63
64using namespace std;
65using namespace FROG_COORD;
66
67const float twopi = 6.283185307179586476925286766559;
68
69FrogDisplay::FrogDisplay() {
70 //Smearing information
71 DET = new RESOLution();
72 nEntryFrog = DET->NEvents_Frog;
73}
74
75FrogDisplay::FrogDisplay(const string& DetDatacard) {
76 //Smearing information
77 DET = new RESOLution();
78 DET->ReadDataCard(DetDatacard);
79 nEntryFrog = DET->NEvents_Frog;
80}
81
82FrogDisplay::FrogDisplay(const RESOLution* DetDatacard) {
83 //Smearing information
84 DET = new RESOLution(*DetDatacard);
85 nEntryFrog = DET->NEvents_Frog;
86}
87
88FrogDisplay::FrogDisplay(const FrogDisplay& frog) {
89 DET = new RESOLution(*(frog.DET));
90 nEntryFrog = DET->NEvents_Frog;
91}
92
93FrogDisplay& FrogDisplay::operator=(const FrogDisplay& frog) {
94 if (this==&frog) return *this;
95 DET = new RESOLution(*(frog.DET));
96 nEntryFrog = DET->NEvents_Frog;
97 return *this;
98}
99
100void FrogDisplay::BuildEvents(const string& outputfilename) {
101 const Font_t kExRootFont = 42;
102 const Float_t kExRootFontSize = 0.07;
103 gROOT->SetStyle("Plain");
104 gROOT->cd();
105 gStyle->SetCanvasColor(10);
106 gStyle->SetPadColor(10);
107 gStyle->SetFillColor(-1);
108 gStyle->SetPaperSize(20, 24);
109 gStyle->SetStatFont(kExRootFont);
110 gStyle->SetTextFont(kExRootFont);
111 gStyle->SetTextSize(kExRootFontSize);
112 gStyle->SetLegendBorderSize(0);
113 gStyle->SetOptStat(0);
114
115 TChain* chain = new TChain("Analysis");
116 TChain* chainGen = new TChain("GEN");
117 chain ->Add(outputfilename.c_str());
118 chainGen->Add(outputfilename.c_str());
119
120 ExRootTreeReader *treeReader = new ExRootTreeReader(chain);
121 ExRootTreeReader *treeReaderGen = new ExRootTreeReader(chainGen);
122
123 const TClonesArray* branchElectron = treeReader ->UseBranch("Electron");
124 const TClonesArray* branchMuon = treeReader ->UseBranch("Muon");
125 const TClonesArray* branchTau = treeReader ->UseBranch("TauJet");
126 const TClonesArray* branchPhoton = treeReader ->UseBranch("Photon");
127 const TClonesArray* branchJet = treeReader ->UseBranch("Jet");
128 const TClonesArray* branchMET = treeReader ->UseBranch("ETmis");
129
130 TRootElectron* elec;
131 TRootMuon* muon;
132 TRootTauJet* tau;
133 TRootPhoton* photon;
134 TRootJet* jet;
135 TRootETmis* met;
136
137 unsigned int allEntries=treeReader->GetEntries();
138
139 FROG_Events* frog_events = new FROG_Events();
140 if(nEntryFrog > allEntries) {
141 cerr <<"** ERROR: number of entries to display > available events **"<< endl;
142 nEntryFrog = allEntries;
143 }
144
145 for(unsigned int entry = 0; entry < nEntryFrog; ++entry){
146 //cout<<"Event n° "<<entry<<endl;
147 treeReader ->ReadEntry(entry);
148 treeReaderGen->ReadEntry(entry);
149
150 //Create a new event
151 FROG_Element_Event* frog_event = new FROG_Element_Event(1,entry);
152 frog_events->AddEvent(frog_event);
153
154 //Create a new branch in the event with name SIM and ID = EVTID_SIM
155 FROG_Element_Base_With_DetId_And_Name* frog_branchSIM = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM,"SIM");
156 frog_event->addDaughter(frog_branchSIM);
157
158
159 //SIM ELEC
160 //Create a new sub-branch in the SIM branch with name Electrons: this sub branch will contais all the electrons
161 FROG_Element_Base_With_DetId_And_Name* frog_branchElectrons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+1000,"Electrons");
162 frog_branchSIM->addDaughter(frog_branchElectrons);
163
164 for(int p=0;p<branchElectron->GetEntriesFast();p++){
165 elec = (TRootElectron*) branchElectron->At(p);
166 // cout<<"Elec nO "<<p<<" PT: "<<elec->PT<<" Eta "<<elec->Eta<<" Phi"<<elec->Phi<<endl;
167 FROG_Element_Event_Candidate* frog_elec = new FROG_Element_Event_Candidate(11,elec->E,elec->Eta,elec->Phi);
168 frog_branchElectrons->addDaughter(frog_elec);
169 }
170
171
172 //SIM MUONS
173 //Create a new sub-branch in the SIM branch with name Muons: this sub branch will contais all the muons
174 FROG_Element_Base_With_DetId_And_Name* frog_branchMuons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+2000,"Muons");
175 frog_branchSIM->addDaughter(frog_branchMuons);
176 for(int p=0;p<branchMuon->GetEntriesFast();p++){
177 muon = (TRootMuon*) branchMuon->At(p);
178 // cout<<"Muon nO"<<p<<" PT: "<<muon->PT<<"Eta "<<muon->Eta<<" Phi"<<muon->Phi<<endl;
179 FROG_Element_Event_Candidate* frog_muon = new FROG_Element_Event_Candidate(13,muon->E,muon->Eta,muon->Phi);
180 frog_branchMuons->addDaughter(frog_muon);
181 }
182
183
184 //SIM TAUS
185 //Create a new sub-branch in the SIM branch with name Taus: this sub branch will contais all the Taus
186 FROG_Element_Base_With_DetId_And_Name* frog_branchTaus = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+3000,"Taus");
187 frog_branchSIM->addDaughter(frog_branchTaus);
188 for(int p=0;p<branchTau->GetEntriesFast();p++){
189 tau = (TRootTauJet*) branchTau->At(p);
190 // cout<<"Tau nO"<<p<<" PT: "<<tau->PT<<"Eta "<<tau->Eta<<" Phi"<<tau->Phi<<endl;
191 FROG_Element_Event_Candidate* frog_tau = new FROG_Element_Event_Candidate(15,tau->E,tau->Eta,tau->Phi);
192 frog_branchTaus->addDaughter(frog_tau);
193 }
194
195
196 //SIM PHOTONS
197 //Create a new sub-branch in the SIM branch with name Photons: this sub branch will contais all the Photons
198 FROG_Element_Base_With_DetId_And_Name* frog_branchPhotons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+4000,"Photons");
199 frog_branchSIM->addDaughter(frog_branchPhotons);
200 for(int p=0;p<branchPhoton->GetEntriesFast();p++){
201 photon = (TRootPhoton*) branchPhoton->At(p);
202 // cout<<"Photon nO"<<p<<" PT: "<<photon->PT<<"Eta "<<photon->Eta<<" Phi"<<photon->Phi<<endl;
203 FROG_Element_Event_Candidate* frog_photon = new FROG_Element_Event_Candidate(22,photon->E,photon->Eta,photon->Phi);
204 frog_branchPhotons->addDaughter(frog_photon);
205 }
206
207
208 //SIM JETS
209 //Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the Jets
210 FROG_Element_Base_With_DetId_And_Name* frog_branchJets = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+5000,"Jets");
211 frog_branchSIM->addDaughter(frog_branchJets);
212 for(int p=0;p<branchJet->GetEntriesFast();p++){
213 jet = (TRootJet*) branchJet->At(p);
214 // cout<<"Jet nO"<<p<<" PT: "<<jet->PT<<"Eta "<<jet->Eta<<" Phi"<<jet->Phi<<endl;
215 FROG_Element_Event_Jet* frog_jet = new FROG_Element_Event_Jet(jet->E,jet->Eta,jet->Phi);
216 frog_branchJets->addDaughter(frog_jet);
217 }
218
219
220 //SIM MET
221 //Create a new sub-branch in the SIM branch with name MET: this sub branch will contais all the METs
222 FROG_Element_Base_With_DetId_And_Name* frog_branchMET = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+6000,"MET");
223 frog_branchSIM->addDaughter(frog_branchMET);
224 for(int p=0;p<branchMET->GetEntriesFast();p++){
225 met = (TRootETmis*) branchMET->At(p);
226 // cout<<"MET nO"<<p<<" ET: "<<met->ET<<"Eta "<<0<<" Phi"<<met->Phi<<endl;
227 FROG_Element_Event_MET* frog_met = new FROG_Element_Event_MET(0,met->ET,0,met->Phi, met->ET);
228 frog_branchMET->addDaughter(frog_met);
229 }
230
231 //Save the event in the .vis file
232 frog_events->SaveInLive("DelphesToFrog.vis",false,false,(unsigned int)-1);
233 }
234
235/* Pointer hierachy
236 frog_events
237 -frog_event
238 -frog_branchSIM
239 -frog_branchElectrons
240 -frog_elec
241 -frog_branchMuons
242 -frog_muon
243 -frog_branchTaus
244 -frog_tau
245 -frog_branchPhotons
246 -frog_photon
247 -frog_photon
248 -frog_jet
249 -frog_branchMET
250 -frog_met
251*/
252
253 delete treeReader;
254 delete treeReaderGen;
255 delete frog_events;
256 delete chain;
257 delete chainGen;
258}
259
260void FrogDisplay::BuildGeom() {
261
262 // This element is the root of the "file" tree. (don't change this line)
263 FROG_Element_Base* prim = new FROG_Element_Base(C_PRIMARY);
264
265 FROG_Element_Base* mygeom = new FROG_Element_Base(C_GEOMETRY);
266 prim->addDaughter(mygeom);
267
268 FROG_Element_Base_With_DetId_And_Name* detector = new FROG_Element_Base_With_DetId_And_Name(900000000,"Delphes");
269 mygeom->addDaughter(detector);
270
271 double Rayon_Tracker=40;
272 double Rayon_Calo = Rayon_Tracker*1.5;
273 double Rayon_Muon = Rayon_Tracker*2;
274 double Lenght_Tracker=100;
275 double Lenght_Calo=Lenght_Tracker+Lenght_Tracker/2.5;
276 double Lenght_Muon=Lenght_Calo+Lenght_Calo/2.5;
277 double Lenght_CaloFwd=Lenght_Muon+Lenght_Muon/2.5;
278
279 int NumPhi=100;
280 float frac=1;
281
282 //************************************************Tracker*************************************************
283 //********************************************************************************************************
284
285 FROG_Element_Base_With_DetId_And_Name* Tracker = new FROG_Element_Base_With_DetId_And_Name(910000000,"Tracker");
286 detector->addDaughter(Tracker);
287 unsigned int DetIdCountTracker = 1;
288
289 double ray=Rayon_Tracker;
290 double rayCone = tan(EtaToTheta(DET->CEN_max_tracker))*Lenght_Tracker/2;
291 if(ray < rayCone)ray=rayCone;
292
293 double dphi = twopi /NumPhi;
294 for(double phi=0; phi<=twopi/frac;phi+=dphi){
295
296 FROG_Element_Primitive_CustomSurface* trackerCone1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
297 rayCone*sin(phi) ,rayCone*cos(phi) ,-Lenght_Tracker/2,
298 rayCone*sin(phi+dphi) ,rayCone*cos(phi+dphi) ,-Lenght_Tracker/2,
299 0 , 0 , 0,
300 0 , 0 , 0);
301 Tracker->addDaughter(trackerCone1); DetIdCountTracker++;
302
303 FROG_Element_Primitive_CustomSurface* trackerCone2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
304 0 , 0 ,0,
305 0 , 0 ,0,
306 rayCone*sin(phi) , rayCone*cos(phi) , Lenght_Tracker/2,
307 rayCone*sin(phi+dphi) , rayCone*sin(phi+dphi) , Lenght_Tracker/2);
308 Tracker->addDaughter(trackerCone2); DetIdCountTracker++;
309
310
311 FROG_Element_Primitive_CustomSurface* trackerB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
312 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Tracker*0.5,
313 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Tracker*0.5,
314 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Tracker*0.5,
315 ray*sin(phi) ,ray*cos(phi) , Lenght_Tracker*0.5);
316 Tracker->addDaughter(trackerB); DetIdCountTracker++;
317
318 FROG_Element_Primitive_CustomSurface* trackerEndCap1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
319 rayCone*sin(phi) , rayCone*cos(phi) , -(Lenght_Tracker)/2,
320 rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , -(Lenght_Tracker)/2,
321 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Tracker)/2,
322 ray*sin(phi) , ray*cos(phi) , -(Lenght_Tracker)/2);
323 Tracker->addDaughter(trackerEndCap1); DetIdCountTracker++;
324
325 FROG_Element_Primitive_CustomSurface* trackerEndCap2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
326 rayCone*sin(phi) , rayCone*cos(phi) , (Lenght_Tracker)/2,
327 rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) , (Lenght_Tracker)/2,
328 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Tracker)/2,
329 ray*sin(phi) , ray*cos(phi) , (Lenght_Tracker)/2);
330 Tracker->addDaughter(trackerEndCap2); DetIdCountTracker++;
331
332 }
333
334 Rayon_Calo = ray*1.5;
335
336 //******************************************Central calorimeters******************************************
337 //********************************************************************************************************
338
339 FROG_Element_Base_With_DetId_And_Name* CALO = new FROG_Element_Base_With_DetId_And_Name(920000000,"Calo");
340 detector->addDaughter(CALO);
341 unsigned int DetIdCountCalo = 1;
342
343 float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Tracker/2;
344 float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Calo/2;
345 ray=Rayon_Calo;
346 if(ray<rayConeF)ray=rayConeF;
347
348 for(double phi=0; phi<=twopi/frac;phi+=dphi){
349
350 //BARREL
351 FROG_Element_Primitive_CustomSurface* caloB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountCalo*10,
352 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Calo*0.5,
353 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Calo*0.5,
354 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Calo*0.5,
355 ray*sin(phi) ,ray*cos(phi) , Lenght_Calo*0.5);
356 CALO->addDaughter(caloB); DetIdCountCalo++;
357
358 //Partial cone + side
359 FROG_Element_Primitive_CustomSurface* caloEndCap1a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
360 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Tracker)/2,
361 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Tracker)/2,
362 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2,
363 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2);
364 CALO->addDaughter(caloEndCap1a); DetIdCountCalo++;
365
366 //Close Endcap + side
367 FROG_Element_Primitive_CustomSurface* caloEndCap1b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
368 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2,
369 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2,
370 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Calo)/2,
371 ray*sin(phi) , ray*cos(phi) , (Lenght_Calo)/2);
372 CALO->addDaughter(caloEndCap1b); DetIdCountCalo++;
373
374 //Partial cone - side
375 FROG_Element_Primitive_CustomSurface* caloEndCap2a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
376 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Tracker)/2,
377 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Tracker)/2,
378 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2,
379 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2);
380 CALO->addDaughter(caloEndCap2a); DetIdCountCalo++;
381
382 //Close Endcap - side
383 FROG_Element_Primitive_CustomSurface* caloEndCap2b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
384 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2,
385 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2,
386 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Calo)/2,
387 ray*sin(phi) , ray*cos(phi) , -(Lenght_Calo)/2);
388 CALO->addDaughter(caloEndCap2b); DetIdCountCalo++;
389
390 }
391
392 Rayon_Muon = ray*1.2;
393
394 //***********************************************Muon chambers********************************************
395 //********************************************************************************************************
396
397 FROG_Element_Base_With_DetId_And_Name* MUON = new FROG_Element_Base_With_DetId_And_Name(930000000,"Muon");
398 detector->addDaughter(MUON);
399 unsigned int DetIdCountMuon = 1;
400
401 rayConeD = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Calo/2;
402 rayConeF = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Muon/2;
403 ray=Rayon_Muon;
404 if(ray<rayConeF)ray=rayConeF;
405
406 for(double phi=0; phi<=twopi/frac;phi+=dphi){
407
408 //BARREL
409 FROG_Element_Primitive_CustomSurface* muonB = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
410 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Muon*0.5,
411 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Muon*0.5,
412 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5,
413 ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5);
414 MUON->addDaughter(muonB); DetIdCountMuon++;
415
416 //Partial cone + side
417 FROG_Element_Primitive_CustomSurface* muonEndCap1a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
418 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Calo)/2,
419 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Calo)/2,
420 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2,
421 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2);
422 MUON->addDaughter(muonEndCap1a); DetIdCountMuon++;
423
424 //Close Endcap + side
425 FROG_Element_Primitive_CustomSurface* muonEndCap1b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
426 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2,
427 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2,
428 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Muon)/2,
429 ray*sin(phi) , ray*cos(phi) , (Lenght_Muon)/2);
430 MUON->addDaughter(muonEndCap1b); DetIdCountMuon++;
431
432 //Partial cone - side
433 FROG_Element_Primitive_CustomSurface* muonEndCap2a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
434 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Calo)/2,
435 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Calo)/2,
436 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2,
437 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2);
438 MUON->addDaughter(muonEndCap2a); DetIdCountMuon++;
439
440 //Close Endcap - side
441 FROG_Element_Primitive_CustomSurface* muonEndCap2b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
442 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2,
443 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2,
444 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Muon)/2,
445 ray*sin(phi) , ray*cos(phi) , -(Lenght_Muon)/2);
446 MUON->addDaughter(muonEndCap2b); DetIdCountMuon++;
447 }
448
449
450 //******************************************Forward calorimeters******************************************
451 //********************************************************************************************************
452
453 FROG_Element_Base_With_DetId_And_Name* CALOFWD = new FROG_Element_Base_With_DetId_And_Name(940000000,"CaloFwd");
454 detector->addDaughter(CALOFWD);
455 unsigned int DetIdCountCaloFwd = 1;
456
457 rayConeD = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_Muon;
458 rayConeF = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_CaloFwd;
459 ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd;
460
461 for(double phi=0; phi<=twopi/frac;phi+=dphi){
462
463 //Partial cone + side
464 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
465 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Muon)/2,
466 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Muon)/2,
467 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2,
468 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2);
469 CALOFWD->addDaughter(caloFWDEndCap1a); DetIdCountCaloFwd++;
470
471 //Close Endcap + side
472 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
473 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2,
474 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2,
475 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_CaloFwd)/2,
476 ray*sin(phi) , ray*cos(phi) , (Lenght_CaloFwd)/2);
477 CALOFWD->addDaughter(caloFWDEndCap1b); DetIdCountCaloFwd++;
478
479 //BARREL
480 FROG_Element_Primitive_CustomSurface* caloFWDB1 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
481 ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5,
482 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5,
483 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_CaloFwd*0.5,
484 ray*sin(phi) ,ray*cos(phi) , Lenght_CaloFwd*0.5);
485 CALOFWD->addDaughter(caloFWDB1); DetIdCountCaloFwd++;
486
487 //Partial cone - side
488 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
489 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Muon)/2,
490 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Muon)/2,
491 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
492 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2);
493 CALOFWD->addDaughter(caloFWDEndCap2a); DetIdCountCaloFwd++;
494
495 //Close Endcap - side
496 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
497 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2,
498 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
499 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
500 ray*sin(phi) , ray*cos(phi) , -(Lenght_CaloFwd)/2);
501 CALOFWD->addDaughter(caloFWDEndCap2b); DetIdCountCaloFwd++;
502
503 //BARREL
504 FROG_Element_Primitive_CustomSurface* caloFWDB2 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
505 ray*sin(phi) ,ray*cos(phi) , -Lenght_Muon*0.5,
506 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_Muon*0.5,
507 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_CaloFwd*0.5,
508 ray*sin(phi) ,ray*cos(phi) , -Lenght_CaloFwd*0.5);
509 CALOFWD->addDaughter(caloFWDB2); DetIdCountCaloFwd++;
510 }
511
512 FROG_Geometry* CustomGeom = new FROG_Geometry(prim);
513 CustomGeom->Save("DelphesToFrog.geom");
514
515 delete prim;
516 delete CustomGeom;
517
518/* pointer hierarchy
519prim
520 -> mygeom
521 -> detector
522 -> Tracker
523 -> CALO
524 -> MUON
525 -> CALOFWD
526pointers that have been added into others will be properly deleted by the destructor of their "mother"
527*/
528
529
530 //FROG_ELEMENT::PrintTree(prim);
531 return;
532
533}
Note: See TracBrowser for help on using the repository browser.