Fork me on GitHub

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

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

new: calorimeter endcaps

File size: 24.4 KB
RevLine 
[260]1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
[443]6** \------------- arXiv:0903.2225v1 ------------/ **
[260]7** **
8** **
9** This package uses: **
10** ------------------ **
[443]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] **
[260]14** FROG: [hep-ex/0901.2718v1] **
[443]15** HepMC: Comput. Phys. Commun.134 (2001) 41 **
[260]16** **
17** ------------------------------------------------------------------ **
18** **
19** Main authors: **
20** ------------- **
21** **
[443]22** Severine Ovyn Xavier Rouby **
23** severine.ovyn@uclouvain.be xavier.rouby@cern **
[260]24** **
[443]25** Center for Particle Physics and Phenomenology (CP3) **
26** Universite catholique de Louvain (UCL) **
27** Louvain-la-Neuve, Belgium **
28** **
[260]29** Copyright (C) 2008-2009, **
[443]30** All rights reserved. **
[260]31** **
32***********************************************************************/
[97]33
[219]34#include <iostream>
[97]35
[219]36#include "TROOT.h"
37#include "TApplication.h"
38#include "TStyle.h"
39#include "TChain.h"
40#include "TClonesArray.h"
[97]41
[219]42#include "BlockClasses.h"
43#include "ExRootTreeReader.h"
44#include "FrogUtil.h"
[97]45
[219]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"
[97]63
64using namespace std;
65using namespace FROG_COORD;
66
[219]67const float twopi = 6.283185307179586476925286766559;
[97]68
[219]69FrogDisplay::FrogDisplay() {
70 //Smearing information
71 DET = new RESOLution();
72 nEntryFrog = DET->NEvents_Frog;
73}
[97]74
[219]75FrogDisplay::FrogDisplay(const string& DetDatacard) {
76 //Smearing information
77 DET = new RESOLution();
78 DET->ReadDataCard(DetDatacard);
79 nEntryFrog = DET->NEvents_Frog;
80}
[112]81
[219]82FrogDisplay::FrogDisplay(const RESOLution* DetDatacard) {
83 //Smearing information
84 DET = new RESOLution(*DetDatacard);
85 nEntryFrog = DET->NEvents_Frog;
86}
[97]87
[219]88FrogDisplay::FrogDisplay(const FrogDisplay& frog) {
89 DET = new RESOLution(*(frog.DET));
90 nEntryFrog = DET->NEvents_Frog;
[97]91}
92
[219]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) {
[97]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
[219]137 unsigned int allEntries=treeReader->GetEntries();
[97]138
139 FROG_Events* frog_events = new FROG_Events();
[219]140 if(nEntryFrog > allEntries) {
[246]141 cerr <<"** ERROR: number of entries to display > available events **"<< endl;
[219]142 nEntryFrog = allEntries;
143 }
144
145 for(unsigned int entry = 0; entry < nEntryFrog; ++entry){
146 //cout<<"Event n° "<<entry<<endl;
[97]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);
[219]157
158
[97]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);
[219]166 // cout<<"Elec nO "<<p<<" PT: "<<elec->PT<<" Eta "<<elec->Eta<<" Phi"<<elec->Phi<<endl;
[97]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 }
[219]170
[97]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);
[219]178 // cout<<"Muon nO"<<p<<" PT: "<<muon->PT<<"Eta "<<muon->Eta<<" Phi"<<muon->Phi<<endl;
[97]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 }
[219]182
[97]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);
[219]190 // cout<<"Tau nO"<<p<<" PT: "<<tau->PT<<"Eta "<<tau->Eta<<" Phi"<<tau->Phi<<endl;
[97]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 }
[219]194
[97]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);
[219]202 // cout<<"Photon nO"<<p<<" PT: "<<photon->PT<<"Eta "<<photon->Eta<<" Phi"<<photon->Phi<<endl;
[107]203 FROG_Element_Event_Candidate* frog_photon = new FROG_Element_Event_Candidate(22,photon->E,photon->Eta,photon->Phi);
[97]204 frog_branchPhotons->addDaughter(frog_photon);
205 }
[219]206
[97]207
208 //SIM JETS
[112]209 //Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the Jets
[97]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);
[219]214 // cout<<"Jet nO"<<p<<" PT: "<<jet->PT<<"Eta "<<jet->Eta<<" Phi"<<jet->Phi<<endl;
[97]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]219
[97]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);
[219]226 // cout<<"MET nO"<<p<<" ET: "<<met->ET<<"Eta "<<0<<" Phi"<<met->Phi<<endl;
[97]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 }
[219]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
[97]253 delete treeReader;
254 delete treeReaderGen;
255 delete frog_events;
[219]256 delete chain;
257 delete chainGen;
[97]258}
259
[219]260void FrogDisplay::BuildGeom() {
261
[97]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);
[219]264
[97]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
[112]271 double Rayon_Tracker=40;
[100]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;
[112]277 double Lenght_CaloFwd=Lenght_Muon+Lenght_Muon/2.5;
[97]278
[112]279 int NumPhi=100;
280 float frac=1;
[97]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;
[112]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
[219]293 double dphi = twopi /NumPhi;
[183]294 for(double phi=0; phi<=twopi/frac;phi+=dphi){
[112]295
296 FROG_Element_Primitive_CustomSurface* trackerCone1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
[183]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);
[112]301 Tracker->addDaughter(trackerCone1); DetIdCountTracker++;
302
303 FROG_Element_Primitive_CustomSurface* trackerCone2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
[183]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);
[112]308 Tracker->addDaughter(trackerCone2); DetIdCountTracker++;
309
310
311 FROG_Element_Primitive_CustomSurface* trackerB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
[183]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);
[112]316 Tracker->addDaughter(trackerB); DetIdCountTracker++;
317
318 FROG_Element_Primitive_CustomSurface* trackerEndCap1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
[183]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);
[112]323 Tracker->addDaughter(trackerEndCap1); DetIdCountTracker++;
324
325 FROG_Element_Primitive_CustomSurface* trackerEndCap2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
[183]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);
[112]330 Tracker->addDaughter(trackerEndCap2); DetIdCountTracker++;
331
[97]332 }
333
[112]334 Rayon_Calo = ray*1.5;
335
[97]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
[494]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;
[112]347 ray=Rayon_Calo;
348 if(ray<rayConeF)ray=rayConeF;
349
[183]350 for(double phi=0; phi<=twopi/frac;phi+=dphi){
[112]351
352 //BARREL
353 FROG_Element_Primitive_CustomSurface* caloB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountCalo*10,
[183]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);
[112]358 CALO->addDaughter(caloB); DetIdCountCalo++;
359
360 //Partial cone + side
361 FROG_Element_Primitive_CustomSurface* caloEndCap1a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
[183]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);
[112]366 CALO->addDaughter(caloEndCap1a); DetIdCountCalo++;
367
368 //Close Endcap + side
369 FROG_Element_Primitive_CustomSurface* caloEndCap1b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
[183]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);
[112]374 CALO->addDaughter(caloEndCap1b); DetIdCountCalo++;
375
376 //Partial cone - side
377 FROG_Element_Primitive_CustomSurface* caloEndCap2a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
[183]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);
[112]382 CALO->addDaughter(caloEndCap2a); DetIdCountCalo++;
383
384 //Close Endcap - side
385 FROG_Element_Primitive_CustomSurface* caloEndCap2b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
[183]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);
[112]390 CALO->addDaughter(caloEndCap2b); DetIdCountCalo++;
391
[97]392 }
[112]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
[183]408 for(double phi=0; phi<=twopi/frac;phi+=dphi){
[112]409
410 //BARREL
411 FROG_Element_Primitive_CustomSurface* muonB = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
[183]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);
[112]416 MUON->addDaughter(muonB); DetIdCountMuon++;
417
418 //Partial cone + side
419 FROG_Element_Primitive_CustomSurface* muonEndCap1a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
[183]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);
[112]424 MUON->addDaughter(muonEndCap1a); DetIdCountMuon++;
425
426 //Close Endcap + side
427 FROG_Element_Primitive_CustomSurface* muonEndCap1b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
[183]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);
[112]432 MUON->addDaughter(muonEndCap1b); DetIdCountMuon++;
433
434 //Partial cone - side
435 FROG_Element_Primitive_CustomSurface* muonEndCap2a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
[183]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);
[112]440 MUON->addDaughter(muonEndCap2a); DetIdCountMuon++;
441
442 //Close Endcap - side
443 FROG_Element_Primitive_CustomSurface* muonEndCap2b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
[183]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);
[112]448 MUON->addDaughter(muonEndCap2b); DetIdCountMuon++;
[97]449 }
450
[112]451
[97]452 //******************************************Forward calorimeters******************************************
453 //********************************************************************************************************
454
[112]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;
[97]458
[112]459 rayConeD = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_Muon;
460 rayConeF = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_CaloFwd;
[494]461 //ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd;
462 ray=tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_CaloFwd;
[112]463
[183]464 for(double phi=0; phi<=twopi/frac;phi+=dphi){
[97]465
[112]466 //Partial cone + side
467 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
[183]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);
[112]472 CALOFWD->addDaughter(caloFWDEndCap1a); DetIdCountCaloFwd++;
473
474 //Close Endcap + side
475 FROG_Element_Primitive_CustomSurface* caloFWDEndCap1b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
[183]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);
[112]480 CALOFWD->addDaughter(caloFWDEndCap1b); DetIdCountCaloFwd++;
481
482 //BARREL
483 FROG_Element_Primitive_CustomSurface* caloFWDB1 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
[183]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);
[112]488 CALOFWD->addDaughter(caloFWDB1); DetIdCountCaloFwd++;
489
490 //Partial cone - side
491 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
[183]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);
[112]496 CALOFWD->addDaughter(caloFWDEndCap2a); DetIdCountCaloFwd++;
497
498 //Close Endcap - side
499 FROG_Element_Primitive_CustomSurface* caloFWDEndCap2b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
[183]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);
[112]504 CALOFWD->addDaughter(caloFWDEndCap2b); DetIdCountCaloFwd++;
505
506 //BARREL
507 FROG_Element_Primitive_CustomSurface* caloFWDB2 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
[183]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);
[112]512 CALOFWD->addDaughter(caloFWDB2); DetIdCountCaloFwd++;
[100]513 }
[219]514
[97]515 FROG_Geometry* CustomGeom = new FROG_Geometry(prim);
516 CustomGeom->Save("DelphesToFrog.geom");
[219]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
[171]533 //FROG_ELEMENT::PrintTree(prim);
[97]534 return;
535
536}
Note: See TracBrowser for help on using the repository browser.