Fork me on GitHub

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

Last change on this file since 238 was 219, checked in by Xavier Rouby, 16 years ago

JetUtils.cc

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