| 1 | void getRate(int dim=0, char *filename = "/big0/Maggi/CamData/Gamma/gamma_15_on.root" )
|
|---|
| 2 | {
|
|---|
| 3 | // This macro has two input parameter:
|
|---|
| 4 | // dim : = 0 -> root file with 1 trigger condition.
|
|---|
| 5 | // > 0 -> number of trigger condition to be analised
|
|---|
| 6 | // in multi conditon file.
|
|---|
| 7 | // < 0 -> selects the -dim trigger condition.
|
|---|
| 8 | //
|
|---|
| 9 | // first we have to create our empty lists
|
|---|
| 10 | //
|
|---|
| 11 | MParList parlist;
|
|---|
| 12 | MTaskList tasklist;
|
|---|
| 13 |
|
|---|
| 14 | //
|
|---|
| 15 | // Setup the parameter list.
|
|---|
| 16 | // - we do not need to create any other container. All of them
|
|---|
| 17 | // are created automatically without loss - we don't have to
|
|---|
| 18 | // access them-
|
|---|
| 19 | //
|
|---|
| 20 | // - we need to create MHMcRate only. The other containers
|
|---|
| 21 | // are created automatically without loss - we don't have to
|
|---|
| 22 | // access them-
|
|---|
| 23 | // - MHMcRate must be created by us because we need the pointer
|
|---|
| 24 | // to it and if it would get created automatically it would also be
|
|---|
| 25 | // deleted automatically
|
|---|
| 26 | // - Actually, depending on using a single trigger option MonteCarlo
|
|---|
| 27 | // file or a multyple trigger option, a MHMcRate or an array of
|
|---|
| 28 | // MHMcRate are needed.
|
|---|
| 29 |
|
|---|
| 30 | parlist.AddToList(&tasklist);
|
|---|
| 31 |
|
|---|
| 32 | if (dim==0){
|
|---|
| 33 | MHMcRate *rate = new MHMcRate();
|
|---|
| 34 | parlist.AddToList(rate);
|
|---|
| 35 | }
|
|---|
| 36 | if (dim<0){
|
|---|
| 37 | char *name = new char[8];
|
|---|
| 38 | name="MHMcRate";
|
|---|
| 39 | char *auxname = new char[8+7];
|
|---|
| 40 | strcpy(auxname, name);
|
|---|
| 41 | sprintf(auxname+8, ";%d", -dim);
|
|---|
| 42 | MHMcRate *ratem = new MHMcRate(auxname);
|
|---|
| 43 | parlist.AddToList(ratem);
|
|---|
| 44 | }
|
|---|
| 45 | else{
|
|---|
| 46 | MHMcRate **ratep = new MHMcRate *[dim];
|
|---|
| 47 | char *name = new char[8];
|
|---|
| 48 | name="MHMcRate";
|
|---|
| 49 | char *auxname = new char[8+7];
|
|---|
| 50 | strcpy(auxname, name);
|
|---|
| 51 | for(int i=0;i<dim;i++){
|
|---|
| 52 | sprintf(auxname+8, ";%d", i+1);
|
|---|
| 53 | ratep[i] = new MHMcRate(auxname);
|
|---|
| 54 | parlist.AddToList(ratep[i]);
|
|---|
| 55 | }
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | //
|
|---|
| 59 | // Setup out tasks:
|
|---|
| 60 | // - First we have to read the events
|
|---|
| 61 | // - Then we can calculate rates, for what the number of
|
|---|
| 62 | // triggered showers from a empty reflector file for the
|
|---|
| 63 | // analised trigger conditions should be set (BgR[])
|
|---|
| 64 | //
|
|---|
| 65 | MReadTree reader("Events", filename);
|
|---|
| 66 | tasklist.AddToList(&reader);
|
|---|
| 67 |
|
|---|
| 68 | Float_t BgR[10]={660,4,0,0,0,0,0,0,0,0};
|
|---|
| 69 | cout<<dim<<endl;
|
|---|
| 70 |
|
|---|
| 71 | MMcTriggerRateCalc rate(dim, 14, BgR, 100000, 2.75, 10.91e-2);
|
|---|
| 72 | tasklist.AddToList(&rate);
|
|---|
| 73 |
|
|---|
| 74 | //
|
|---|
| 75 | // set up the loop for the processing
|
|---|
| 76 | //
|
|---|
| 77 | MEvtLoop magic;
|
|---|
| 78 | magic.SetParList(&parlist);
|
|---|
| 79 |
|
|---|
| 80 | //
|
|---|
| 81 | // Start to loop over all events
|
|---|
| 82 | //
|
|---|
| 83 | magic.Eventloop();
|
|---|
| 84 |
|
|---|
| 85 | }
|
|---|