Fork me on GitHub

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

Last change on this file since 648 was 580, checked in by cp3-support, 13 years ago

updated to use FROG 3.0

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