Fork me on GitHub

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

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

new: calorimeter endcaps

File size: 24.4 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 float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_Tracker/2;
346 float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_Calo/2;
347 ray=Rayon_Calo;
348 if(ray<rayConeF)ray=rayConeF;
349
350 for(double phi=0; phi<=twopi/frac;phi+=dphi){
351
352 //BARREL
353 FROG_Element_Primitive_CustomSurface* caloB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountCalo*10,
354 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Calo*0.5,
355 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Calo*0.5,
356 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Calo*0.5,
357 ray*sin(phi) ,ray*cos(phi) , Lenght_Calo*0.5);
358 CALO->addDaughter(caloB); DetIdCountCalo++;
359
360 //Partial cone + side
361 FROG_Element_Primitive_CustomSurface* caloEndCap1a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
362 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Tracker)/2,
363 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Tracker)/2,
364 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2,
365 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2);
366 CALO->addDaughter(caloEndCap1a); DetIdCountCalo++;
367
368 //Close Endcap + side
369 FROG_Element_Primitive_CustomSurface* caloEndCap1b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
370 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Calo)/2,
371 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Calo)/2,
372 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Calo)/2,
373 ray*sin(phi) , ray*cos(phi) , (Lenght_Calo)/2);
374 CALO->addDaughter(caloEndCap1b); DetIdCountCalo++;
375
376 //Partial cone - side
377 FROG_Element_Primitive_CustomSurface* caloEndCap2a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
378 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Tracker)/2,
379 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Tracker)/2,
380 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2,
381 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2);
382 CALO->addDaughter(caloEndCap2a); DetIdCountCalo++;
383
384 //Close Endcap - side
385 FROG_Element_Primitive_CustomSurface* caloEndCap2b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
386 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Calo)/2,
387 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Calo)/2,
388 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Calo)/2,
389 ray*sin(phi) , ray*cos(phi) , -(Lenght_Calo)/2);
390 CALO->addDaughter(caloEndCap2b); DetIdCountCalo++;
391
392 }
393
394 Rayon_Muon = ray*1.2;
395
396 //***********************************************Muon chambers********************************************
397 //********************************************************************************************************
398
399 FROG_Element_Base_With_DetId_And_Name* MUON = new FROG_Element_Base_With_DetId_And_Name(930000000,"Muon");
400 detector->addDaughter(MUON);
401 unsigned int DetIdCountMuon = 1;
402
403 rayConeD = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Calo/2;
404 rayConeF = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Muon/2;
405 ray=Rayon_Muon;
406 if(ray<rayConeF)ray=rayConeF;
407
408 for(double phi=0; phi<=twopi/frac;phi+=dphi){
409
410 //BARREL
411 FROG_Element_Primitive_CustomSurface* muonB = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
412 ray*sin(phi) ,ray*cos(phi) ,-Lenght_Muon*0.5,
413 ray*sin(phi+dphi) ,ray*cos(phi+dphi) ,-Lenght_Muon*0.5,
414 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5,
415 ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5);
416 MUON->addDaughter(muonB); DetIdCountMuon++;
417
418 //Partial cone + side
419 FROG_Element_Primitive_CustomSurface* muonEndCap1a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
420 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Calo)/2,
421 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Calo)/2,
422 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2,
423 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2);
424 MUON->addDaughter(muonEndCap1a); DetIdCountMuon++;
425
426 //Close Endcap + side
427 FROG_Element_Primitive_CustomSurface* muonEndCap1b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
428 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_Muon)/2,
429 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_Muon)/2,
430 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_Muon)/2,
431 ray*sin(phi) , ray*cos(phi) , (Lenght_Muon)/2);
432 MUON->addDaughter(muonEndCap1b); DetIdCountMuon++;
433
434 //Partial cone - side
435 FROG_Element_Primitive_CustomSurface* muonEndCap2a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
436 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Calo)/2,
437 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Calo)/2,
438 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2,
439 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2);
440 MUON->addDaughter(muonEndCap2a); DetIdCountMuon++;
441
442 //Close Endcap - side
443 FROG_Element_Primitive_CustomSurface* muonEndCap2b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
444 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_Muon)/2,
445 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_Muon)/2,
446 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_Muon)/2,
447 ray*sin(phi) , ray*cos(phi) , -(Lenght_Muon)/2);
448 MUON->addDaughter(muonEndCap2b); DetIdCountMuon++;
449 }
450
451
452 //******************************************Forward calorimeters******************************************
453 //********************************************************************************************************
454
455 FROG_Element_Base_With_DetId_And_Name* CALOFWD = new FROG_Element_Base_With_DetId_And_Name(940000000,"CaloFwd");
456 detector->addDaughter(CALOFWD);
457 unsigned int DetIdCountCaloFwd = 1;
458
459 rayConeD = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_Muon;
460 rayConeF = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_CaloFwd;
461 //ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd;
462 ray=tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_CaloFwd;
463
464 for(double phi=0; phi<=twopi/frac;phi+=dphi){
465
466 //Partial cone + side
467 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
468 rayConeD*sin(phi) , rayConeD*cos(phi) , (Lenght_Muon)/2,
469 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , (Lenght_Muon)/2,
470 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2,
471 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2);
472 CALOFWD->addDaughter(caloFWDEndCap1a); DetIdCountCaloFwd++;
473
474 //Close Endcap + side
475 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
476 rayConeF*sin(phi) , rayConeF*cos(phi) , (Lenght_CaloFwd)/2,
477 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , (Lenght_CaloFwd)/2,
478 ray*sin(phi+dphi) , ray*cos(phi+dphi) , (Lenght_CaloFwd)/2,
479 ray*sin(phi) , ray*cos(phi) , (Lenght_CaloFwd)/2);
480 CALOFWD->addDaughter(caloFWDEndCap1b); DetIdCountCaloFwd++;
481
482 //BARREL
483 FROG_Element_Primitive_CustomSurface* caloFWDB1 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
484 ray*sin(phi) ,ray*cos(phi) , Lenght_Muon*0.5,
485 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_Muon*0.5,
486 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , Lenght_CaloFwd*0.5,
487 ray*sin(phi) ,ray*cos(phi) , Lenght_CaloFwd*0.5);
488 CALOFWD->addDaughter(caloFWDB1); DetIdCountCaloFwd++;
489
490 //Partial cone - side
491 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
492 rayConeD*sin(phi) , rayConeD*cos(phi) , -(Lenght_Muon)/2,
493 rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) , -(Lenght_Muon)/2,
494 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
495 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2);
496 CALOFWD->addDaughter(caloFWDEndCap2a); DetIdCountCaloFwd++;
497
498 //Close Endcap - side
499 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
500 rayConeF*sin(phi) , rayConeF*cos(phi) , -(Lenght_CaloFwd)/2,
501 rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
502 ray*sin(phi+dphi) , ray*cos(phi+dphi) , -(Lenght_CaloFwd)/2,
503 ray*sin(phi) , ray*cos(phi) , -(Lenght_CaloFwd)/2);
504 CALOFWD->addDaughter(caloFWDEndCap2b); DetIdCountCaloFwd++;
505
506 //BARREL
507 FROG_Element_Primitive_CustomSurface* caloFWDB2 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
508 ray*sin(phi) ,ray*cos(phi) , -Lenght_Muon*0.5,
509 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_Muon*0.5,
510 ray*sin(phi+dphi) ,ray*cos(phi+dphi) , -Lenght_CaloFwd*0.5,
511 ray*sin(phi) ,ray*cos(phi) , -Lenght_CaloFwd*0.5);
512 CALOFWD->addDaughter(caloFWDB2); DetIdCountCaloFwd++;
513 }
514
515 FROG_Geometry* CustomGeom = new FROG_Geometry(prim);
516 CustomGeom->Save("DelphesToFrog.geom");
517
518 delete prim;
519 delete CustomGeom;
520
521/* pointer hierarchy
522prim
523 -> mygeom
524 -> detector
525 -> Tracker
526 -> CALO
527 -> MUON
528 -> CALOFWD
529pointers that have been added into others will be properly deleted by the destructor of their "mother"
530*/
531
532
533 //FROG_ELEMENT::PrintTree(prim);
534 return;
535
536}
Note: See TracBrowser for help on using the repository browser.