]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/macros/Config.C
ACORDEv1 is now the default
[u/mrichter/AliRoot.git] / ACORDE / macros / Config.C
1 //
2
3 // Configuration for the Physics Data Challenge 2006
4
5 //
6
7
8
9 // One can use the configuration macro in compiled mode by
10
11 // root [0] gSystem->Load("libgeant321");
12
13 // root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
14
15 //                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
16
17 // root [0] .x grun.C(1,"Config_PDC06.C++")
18
19
20
21 #if !defined(__CINT__) || defined(__MAKECINT__)
22
23 #include <Riostream.h>
24
25 #include <TRandom.h>
26
27 #include <TDatime.h>
28
29 #include <TSystem.h>
30
31 #include <TVirtualMC.h>
32
33 #include <TGeant3TGeo.h>
34
35 #include "EVGEN/AliGenCocktail.h"
36
37 #include "EVGEN/AliGenParam.h"
38
39 #include "EVGEN/AliGenMUONlib.h"
40
41 #include "STEER/AliRunLoader.h"
42
43 #include "STEER/AliRun.h"
44
45 #include "STEER/AliConfig.h"
46
47 #include "PYTHIA6/AliDecayerPythia.h"
48
49 #include "PYTHIA6/AliGenPythia.h"
50
51 #include "STEER/AliMagFMaps.h"
52
53 #include "STRUCT/AliBODY.h"
54
55 #include "STRUCT/AliMAG.h"
56
57 #include "STRUCT/AliABSOv0.h"
58
59 #include "STRUCT/AliDIPOv2.h"
60
61 #include "STRUCT/AliHALL.h"
62
63 #include "STRUCT/AliFRAMEv2.h"
64
65 #include "STRUCT/AliSHILv2.h"
66
67 #include "STRUCT/AliPIPEv0.h"
68
69 #include "ITS/AliITSgeom.h"
70
71 #include "ITS/AliITSvPPRasymmFMD.h"
72
73 #include "TPC/AliTPCv2.h"
74
75 #include "TOF/AliTOFv5T0.h"
76
77 #include "HMPID/AliHMPIDv1.h"
78
79 #include "ZDC/AliZDCv2.h"
80
81 #include "TRD/AliTRDv1.h"
82
83 #include "FMD/AliFMDv1.h"
84
85 #include "MUON/AliMUONv1.h"
86
87 #include "PHOS/AliPHOSv1.h"
88
89 #include "PMD/AliPMDv1.h"
90
91 #include "T0/AliT0v1.h"
92
93 #include "EMCAL/AliEMCALv2.h"
94
95 #include "CRT/AliCRTv0.h"
96
97 #include "VZERO/AliVZEROv7.h"
98
99 #endif
100
101
102
103 //--- Trigger config ---
104
105 enum TrigConf_t
106
107 {
108
109     kDefaultPPTrig, kDefaultPbPbTrig
110
111 };
112
113
114
115 const char * TrigConfName[] = {
116
117     "p-p","Pb-Pb"
118
119 };
120
121
122
123
124
125
126
127 //--- Decay Mode ---
128
129 enum DecayHvFl_t 
130
131 {
132
133   kNature,  kHadr, kSemiEl, kSemiMu
134
135 };
136
137 //--- Rapidity Cut ---
138
139 enum YCut_t
140
141 {
142
143   kFull, kBarrel, kMuonArm
144
145 };
146
147 //--- Magnetic Field ---
148
149 enum Mag_t
150
151 {
152
153     k2kG, k4kG, k5kG
154
155 };
156
157
158
159 void ProcessEnvironmentVars();
160
161
162
163 // This part for configuration
164
165 static DecayHvFl_t   decHvFl  = kNature; 
166
167 static YCut_t        ycut     = kFull;
168
169 static Mag_t         mag      = k5kG; 
170
171 static TrigConf_t    trig     = kDefaultPPTrig; 
172
173 //========================//
174
175 // Set Random Number seed //
176
177 //========================//
178
179 TDatime dt;
180
181 static UInt_t seed    = dt.Get();
182
183
184
185
186
187 // Comment line
188
189 static TString comment;
190
191
192
193 void Config()
194
195 {
196
197  
198
199
200
201   // Get settings from environment variables
202
203   ProcessEnvironmentVars();
204
205
206
207   gRandom->SetSeed(seed);
208
209   //  gRandom->SetSeed(12345);
210
211   cerr<<"Seed for random number generation= "<<seed<<endl; 
212
213
214
215   // libraries required by geant321
216
217 #if defined(__CINT__)
218
219   gSystem->Load("libgeant321");
220
221 #endif
222
223
224
225   new TGeant3TGeo("C++ Interface to Geant3");
226
227
228
229   //=======================================================================
230
231   //  Create the output file
232
233
234
235    
236
237   AliRunLoader* rl=0x0;
238
239
240
241   cout<<"Config.C: Creating Run Loader ..."<<endl;
242
243   rl = AliRunLoader::Open("galice.root",
244
245                           AliConfig::GetDefaultEventFolderName(),
246
247                           "recreate");
248
249   if (rl == 0x0)
250
251     {
252
253       gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
254
255       return;
256
257     }
258
259   rl->SetCompressionLevel(2);
260
261   rl->SetNumberOfEventsPerFile(1000);
262
263   gAlice->SetRunLoader(rl);
264
265   
266
267   // Set the trigger configuration
268
269   gAlice->SetTriggerDescriptor(TrigConfName[trig]);
270
271   cout<<"Trigger configuration is set to  "<<TrigConfName[trig]<<endl;
272
273
274
275   //
276
277   //=======================================================================
278
279   // ************* STEERING parameters FOR ALICE SIMULATION **************
280
281   // --- Specify event type to be tracked through the ALICE setup
282
283   // --- All positions are in cm, angles in degrees, and P and E in GeV
284
285
286
287
288
289     gMC->SetProcess("DCAY",1);
290
291     gMC->SetProcess("PAIR",1);
292
293     gMC->SetProcess("COMP",1);
294
295     gMC->SetProcess("PHOT",1);
296
297     gMC->SetProcess("PFIS",0);
298
299     gMC->SetProcess("DRAY",0);
300
301     gMC->SetProcess("ANNI",1);
302
303     gMC->SetProcess("BREM",1);
304
305     gMC->SetProcess("MUNU",1);
306
307     gMC->SetProcess("CKOV",1);
308
309     gMC->SetProcess("HADR",1);
310
311     gMC->SetProcess("LOSS",2);
312
313     gMC->SetProcess("MULS",1);
314
315     gMC->SetProcess("RAYL",1);
316
317
318
319     Float_t cut = 1.e-3;        // 1MeV cut by default
320
321     Float_t tofmax = 1.e10;
322
323
324
325     gMC->SetCut("CUTGAM", cut);
326
327     gMC->SetCut("CUTELE", cut);
328
329     gMC->SetCut("CUTNEU", cut);
330
331     gMC->SetCut("CUTHAD", cut);
332
333     gMC->SetCut("CUTMUO", cut);
334
335     gMC->SetCut("BCUTE",  cut); 
336
337     gMC->SetCut("BCUTM",  cut); 
338
339     gMC->SetCut("DCUTE",  cut); 
340
341     gMC->SetCut("DCUTM",  cut); 
342
343     gMC->SetCut("PPCUTM", cut);
344
345     gMC->SetCut("TOFMAX", tofmax); 
346
347     //    ((TGeant3 *) gMC)->SetSWIT(2,2); 
348
349     //    ((TGeant3 *) gMC)->SetDEBU(1,999,1); 
350
351
352
353
354
355
356
357
358
359   // Set External decayer //
360
361   //======================//
362
363   TVirtualMCDecayer* decayer = new AliDecayerPythia();
364
365   // DECAYS
366
367   //
368
369   switch(decHvFl) {
370
371   case kNature:
372
373     decayer->SetForceDecay(kAll);
374
375     break;
376
377   case kHadr:
378
379     decayer->SetForceDecay(kHadronicD);
380
381     break;
382
383   case kSemiEl:
384
385     decayer->SetForceDecay(kSemiElectronic);
386
387     break;
388
389   case kSemiMu:
390
391     decayer->SetForceDecay(kSemiMuonic);
392
393     break;
394
395   }
396
397   decayer->Init();
398
399   gMC->SetExternalDecayer(decayer);
400
401
402
403   //=========================//
404
405   // Generator Configuration //
406
407   //=========================//
408
409   AliGenBox* gener = new AliGenBox();
410
411   gener->SetThetaRange(45,135);
412
413   gener->SetPhiRange(30,150);
414
415   gener->SetMomentumRange(9.8,10.2);
416
417   gener->SetPart(kMuonMinus);
418
419   gener->SetNumberParticles(20);
420
421
422
423
424
425   gener->Init();
426
427
428
429   // FIELD
430
431   //    
432
433   if (mag == k2kG) {
434
435     comment = comment.Append(" | L3 field 0.2 T");
436
437   } else if (mag == k4kG) {
438
439     comment = comment.Append(" | L3 field 0.4 T");
440
441   } else if (mag == k5kG) {
442
443     comment = comment.Append(" | L3 field 0.5 T");
444
445   }
446
447   printf("\n \n Comment: %s \n \n", comment.Data());
448
449     
450
451   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., mag);
452
453   field->SetL3ConstField(0); //Using const. field in the barrel
454
455   rl->CdGAFile();
456
457   gAlice->SetField(field);    
458
459
460
461
462
463
464
465   Int_t iABSO  = 0;
466
467   Int_t iACORDE = 1;
468
469   Int_t iDIPO  = 0;
470
471   Int_t iEMCAL = 0;
472
473   Int_t iFMD   = 0;
474
475   Int_t iFRAME = 0;
476
477   Int_t iHALL  = 0;
478
479   Int_t iITS   = 0;
480
481   Int_t iMAG   = 0;
482
483   Int_t iMUON  = 0;
484
485   Int_t iPHOS  = 0;
486
487   Int_t iPIPE  = 0;
488
489   Int_t iPMD   = 0;
490
491   Int_t iHMPID  = 0;
492
493   Int_t iSHIL  = 0;
494
495   Int_t iT0 = 0;
496
497   Int_t iTOF   = 0;
498
499   Int_t iTPC   = 0;
500
501   Int_t iTRD   = 0;
502
503   Int_t iVZERO = 0;
504
505   Int_t iZDC   = 0;
506
507   
508
509
510
511     //=================== Alice BODY parameters =============================
512
513     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
514
515
516
517
518
519     if (iMAG)
520
521     {
522
523         //=================== MAG parameters ============================
524
525         // --- Start with Magnet since detector layouts may be depending ---
526
527         // --- on the selected Magnet dimensions ---
528
529         AliMAG *MAG = new AliMAG("MAG", "Magnet");
530
531     }
532
533
534
535
536
537     if (iABSO)
538
539     {
540
541         //=================== ABSO parameters ============================
542
543         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
544
545     }
546
547
548
549     if (iDIPO)
550
551     {
552
553         //=================== DIPO parameters ============================
554
555
556
557         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
558
559     }
560
561
562
563     if (iHALL)
564
565     {
566
567         //=================== HALL parameters ============================
568
569
570
571         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
572
573     }
574
575
576
577
578
579     if (iFRAME)
580
581     {
582
583         //=================== FRAME parameters ============================
584
585
586
587         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
588
589     }
590
591
592
593     if (iSHIL)
594
595     {
596
597         //=================== SHIL parameters ============================
598
599
600
601         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
602
603     }
604
605
606
607
608
609     if (iPIPE)
610
611     {
612
613         //=================== PIPE parameters ============================
614
615
616
617         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
618
619     }
620
621  
622
623     if(iITS) {
624
625
626
627     //=================== ITS parameters ============================
628
629     //
630
631     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
632
633     // almost all other detectors. This involves the fact that the ITS geometry
634
635     // still has several options to be followed in parallel in order to determine
636
637     // the best set-up which minimizes the induced background. All the geometries
638
639     // available to date are described in the following. Read carefully the comments
640
641     // and use the default version (the only one uncommented) unless you are making
642
643     // comparisons and you know what you are doing. In this case just uncomment the
644
645     // ITS geometry you want to use and run Aliroot.
646
647     //
648
649     // Detailed geometries:         
650
651     //
652
653     //
654
655     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
656
657     //
658
659     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
660
661     //
662
663         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
664
665         ITS->SetMinorVersion(2);  // don't touch this parameter if you're not an ITS developer
666
667         ITS->SetReadDet(kFALSE);          // don't touch this parameter if you're not an ITS developer
668
669     //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
670
671         ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
672
673         ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
674
675         ITS->SetThicknessChip1(150.);  // chip thickness on layer 1 must be in the range [150,300]
676
677         ITS->SetThicknessChip2(150.);  // chip thickness on layer 2 must be in the range [150,300]
678
679         ITS->SetRails(0);            // 1 --> rails in ; 0 --> rails out
680
681         ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
682
683
684
685     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
686
687     // for reconstruction !):
688
689     //                                                     
690
691     //
692
693     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
694
695     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
696
697     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
698
699     //
700
701     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
702
703     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
704
705     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
706
707     //                      
708
709     //
710
711     //
712
713     // Geant3 <-> EUCLID conversion
714
715     // ============================
716
717     //
718
719     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
720
721     // media to two ASCII files (called by default ITSgeometry.euc and
722
723     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
724
725     // The default (=0) means that you dont want to use this facility.
726
727     //
728
729         ITS->SetEUCLID(0);  
730
731     }
732
733
734
735     if (iTPC)
736
737     {
738
739       //============================ TPC parameters =====================
740
741         AliTPC *TPC = new AliTPCv2("TPC", "Default");
742
743     }
744
745
746
747
748
749     if (iTOF) {
750
751         //=================== TOF parameters ============================
752
753         AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
754
755         // Partial geometry: modules at 2,3,4,6,7,11,12,14,15,16
756
757         // starting at 6h in positive direction
758
759         //      Int_t TOFSectors[18]={-1,-1,0,0,0,-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0};
760
761         // Partial geometry: modules at 1,2,6,7,9,10,11,12,15,16,17
762
763         // (ALICE numbering convention)
764
765         Int_t TOFSectors[18]={-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0,-1,-1,0,0,0};
766
767         TOF->SetTOFSectors(TOFSectors);
768
769     }
770
771
772
773
774
775     if (iHMPID)
776
777     {
778
779         //=================== HMPID parameters ===========================
780
781         AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
782
783
784
785     }
786
787
788
789
790
791     if (iZDC)
792
793     {
794
795         //=================== ZDC parameters ============================
796
797
798
799         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
800
801     }
802
803
804
805     if (iTRD)
806
807     {
808
809         //=================== TRD parameters ============================
810
811
812
813         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
814
815         AliTRDgeometry *geoTRD = TRD->GetGeometry();
816
817         // Partial geometry: modules at 2,3,4,6,11,12,14,15
818
819         // starting at 6h in positive direction
820
821         geoTRD->SetSMstatus(0,0);
822
823         geoTRD->SetSMstatus(1,0);
824
825         geoTRD->SetSMstatus(5,0);
826
827         geoTRD->SetSMstatus(7,0);
828
829         geoTRD->SetSMstatus(8,0);
830
831         geoTRD->SetSMstatus(9,0);
832
833         geoTRD->SetSMstatus(10,0);
834
835         geoTRD->SetSMstatus(13,0);
836
837         geoTRD->SetSMstatus(16,0);
838
839         geoTRD->SetSMstatus(17,0);
840
841     }
842
843
844
845     if (iFMD)
846
847     {
848
849         //=================== FMD parameters ============================
850
851         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
852
853    }
854
855
856
857     if (iMUON)
858
859     {
860
861         //=================== MUON parameters ===========================
862
863         // New MUONv1 version (geometry defined via builders)
864
865         AliMUON *MUON = new AliMUONv1("MUON", "default");
866
867     }
868
869     //=================== PHOS parameters ===========================
870
871
872
873     if (iPHOS)
874
875     {
876
877         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
878
879     }
880
881
882
883
884
885     if (iPMD)
886
887     {
888
889         //=================== PMD parameters ============================
890
891         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
892
893     }
894
895
896
897     if (iT0)
898
899     {
900
901         //=================== T0 parameters ============================
902
903         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
904
905     }
906
907
908
909     if (iEMCAL)
910
911     {
912
913         //=================== EMCAL parameters ============================
914
915         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
916
917     }
918
919
920
921      if (iACORDE)
922
923     {
924
925         //=================== ACORDE parameters ============================
926
927         AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
928
929         // ACORDE->SetITSGeometry(kTRUE);
930
931         // ACORDE->SetCreateCavern(kFALSE);
932
933     }
934
935
936
937      if (iVZERO)
938
939     {
940
941         //=================== VZERO parameters =============================
942
943         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
944
945     }
946
947 }
948
949
950
951 void ProcessEnvironmentVars()
952
953 {
954
955     // Run type
956
957     if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
958
959       for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
960
961         if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
962
963           proc = (PDC06Proc_t)iRun;
964
965           cout<<"Run type set to "<<pprRunName[iRun]<<endl;
966
967         }
968
969       }
970
971     }
972
973
974
975     // Random Number seed
976
977     if (gSystem->Getenv("CONFIG_SEED")) {
978
979       seed = atoi(gSystem->Getenv("CONFIG_SEED"));
980
981     }
982
983 }
984
985
986
987
988
989
990