Ignore:
Timestamp:
02/11/05 20:00:01 (20 years ago)
Author:
moralejo
Message:
Added to output container "MMcEvtBasic" with the most important MC
parameters, to be kept for all events (triggered or not) through
the whole analysis chain in order to allow the calculation of effective
areas.

Updated version of MRawRunHeader from 4 to 5. This means the trigger and
calibration patterns are correctly set and can be decoded.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx

    r6365 r6386  
    4646#include "MRawCrateData.h"
    4747#include "MMcEvt.hxx"
     48#include "MMcEvtBasic.h"
    4849#include "MMcTrig.hxx"
    4950#include "MMcRunHeader.hxx"
     
    11021103  }
    11031104
    1104   MMcEvt  **McEvt = NULL;
    1105 
    1106   if (Write_McEvt) {
    1107     if (ct_Number>1){
    1108       McEvt = new MMcEvt *[numberBranches];
    1109       for (int i=0;i<numberBranches;i++)
    1110         McEvt[i]=new MMcEvt();
    1111     }
    1112     else {
    1113       McEvt = new MMcEvt *[1];
    1114       McEvt[0]=new MMcEvt();
    1115     }
    1116   }
     1105  MMcEvt      **McEvt = NULL;
     1106  MMcEvtBasic **McEvtBasic = NULL;
     1107
     1108  if (Write_McEvt)
     1109    {
     1110      McEvt = new MMcEvt *[ct_Number];
     1111      McEvtBasic = new MMcEvtBasic *[ct_Number];
     1112      for (int i = 0; i < ct_Number; i++)
     1113        {
     1114          McEvt[i] = new MMcEvt();
     1115          McEvtBasic[i] = new MMcEvtBasic();
     1116        }
     1117    }
    11171118  // 
    11181119  // initalize a temporal ROOT file
     
    12051206
    12061207  RunHeader->SetMagicNumber(MRawRunHeader::kMagicNumber);
    1207   RunHeader->SetFormatVersion(4);
     1208  RunHeader->SetFormatVersion(5);
    12081209  RunHeader->SetSoftVersion((UShort_t) (VERSION*10));
    12091210  RunHeader->SetRunType(256);
     
    13831384  TTree EvtTree("Events","Normal Triggered Events");
    13841385
    1385   if (Write_McEvt && ct_Number==1){
    1386 
    1387     EvtTree.Branch("MMcEvt.","MMcEvt",
    1388                    &McEvt[0]);
    1389   }
    1390 
    1391   if (Write_McEvt && ct_Number!=1){
    1392     ibr=0;
    1393     for(char branchname[256];ibr<numberBranches;ibr++){
    1394      
    1395       sprintf(help,"%i",ibr+1);
    1396       strcpy (branchname, "MMcEvt;");
    1397       strcat (branchname, & help[0]);
    1398       strcat (branchname, ".");
    1399       EvtTree.Branch(branchname,"MMcEvt",
    1400                      &McEvt[ibr]);
    1401     }
    1402   }
     1386  if (Write_McEvt && ct_Number == 1)
     1387    {
     1388      EvtTree.Branch("MMcEvt.","MMcEvt", &McEvt[0]);
     1389      EvtTree.Branch("MMcEvtBasic.","MMcEvtBasic", &McEvtBasic[0]);
     1390    }
     1391
     1392  if (Write_McEvt && ct_Number!=1)
     1393    {
     1394      ibr=0;
     1395      for(char branchname[256]; ibr < numberBranches; ibr++)
     1396        {
     1397          sprintf(help,"%i",ibr+1);
     1398          strcpy (branchname, "MMcEvt;");
     1399          strcat (branchname, & help[0]);
     1400          strcat (branchname, ".");
     1401          EvtTree.Branch(branchname,"MMcEvt",
     1402                         &McEvt[ibr]);
     1403        }
     1404      for(char branchname[256]; ibr < numberBranches; ibr++)
     1405        {
     1406          sprintf(help,"%i",ibr+1);
     1407          strcpy (branchname, "MMcEvtBasic;");
     1408          strcat (branchname, & help[0]);
     1409          strcat (branchname, ".");
     1410          EvtTree.Branch(branchname,"MMcEvtBasic",
     1411                         &McEvtBasic[ibr]);
     1412        }
     1413    }
    14031414
    14041415  if(!Trigger_Loop && ct_Number==1){
     
    23322343                if (reflector_file_version<6){
    23332344                  mcevth[0].get_times(&ftime, &ltime);
     2345
     2346                  McEvtBasic[0]->Fill((MMcEvt::ParticleId_t) mcevth[0].get_primary(),
     2347                                      mcevth[0].get_energy(), impactD[0],
     2348                                      phiCT[0], thetaCT[0]);
     2349
    23342350                  McEvt[0]->Fill( 0,
    23352351                                  (UShort_t) mcevth[0].get_primary() ,
     
    23722388                  mcevth_2[0].get_times(&ftime, &ltime);
    23732389                  chi2=mcevth_2[0].get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c);
     2390
     2391                  McEvtBasic[0]->Fill((MMcEvt::ParticleId_t) mcevth_2[0].get_primary(),
     2392                                      mcevth_2[0].get_energy(), impactD[0],
     2393                                      mcevth_2[0].get_phi_CT(),
     2394                                      mcevth_2[0].get_theta_CT());
     2395
    23742396                  McEvt[0]->Fill((UInt_t) mcevth_2[0].get_evt_number(),
    23752397                                 (UShort_t) mcevth_2[0].get_primary() ,
     
    24252447              }
    24262448              if (Write_McEvt)
    2427                 McEvt[0]->Clear() ; 
     2449                {
     2450                  McEvt[0]->Clear();
     2451                  McEvtBasic[0]->Clear();
     2452                }
    24282453            }
    24292454          }
     
    25892614              //
    25902615           
    2591 
    25922616              for (int ict=0;ict<ct_Number;ict++){
    25932617                Float_t ftime, ltime;
    25942618                if (reflector_file_version<6){
    25952619                  mcevth[ict].get_times(&ftime, &ltime);
     2620
     2621                  McEvtBasic[ict]->Fill((MMcEvt::ParticleId_t) mcevth[0].get_primary(),
     2622                                        mcevth[ict].get_energy(), impactD[ict],
     2623                                        phiCT[ict], thetaCT[ict]);
     2624
    25962625                  McEvt[ict]->Fill( 0,
    25972626                                  (UShort_t) mcevth[0].get_primary() ,
     
    26322661                  mcevth_2[ict].get_times(&ftime, &ltime);
    26332662                  chi2=mcevth_2[ict].get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c);
     2663
     2664                  McEvtBasic[ict]->Fill((MMcEvt::ParticleId_t)mcevth_2[ict].get_primary(),
     2665                                        mcevth_2[ict].get_energy(), impactD[ict],
     2666                                        mcevth_2[ict].get_phi_CT(),
     2667                                        mcevth_2[ict].get_theta_CT());
     2668 
     2669
    26342670                  McEvt[ict]->Fill( (UInt_t) mcevth_2[ict].get_evt_number(),
    26352671                                  (UShort_t) mcevth_2[ict].get_primary() ,
     
    26832719            if (Write_RawEvt) EvtData[ict]->ResetPixels(0,0);
    26842720            if (Write_McTrig) McTrig[ict]->Clear() ;
    2685             if (Write_McEvt) McEvt[ict]->Clear() ;
     2721            if (Write_McEvt)
     2722              {
     2723                McEvt[ict]->Clear() ;
     2724                McEvtBasic[ict]->Clear();
     2725              }
    26862726          }
    26872727        }
     
    49835023//
    49845024// $Log: not supported by cvs2svn $
     5025// Revision 1.87  2005/02/10 19:28:10  moralejo
     5026//
     5027// Substituted input card option "write_all_events" by
     5028// "write_all_event_headers". If set, this will make camera to write out
     5029// the event headers of all the processed events, no matter whether they
     5030// have triggered or not.
     5031//
    49855032// Revision 1.86  2005/02/10 14:49:21  moralejo
    49865033//
Note: See TracChangeset for help on using the changeset viewer.