Fork me on GitHub

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

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

add header

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