Changeset 438


Ignore:
Timestamp:
10/25/00 09:14:23 (24 years ago)
Author:
magicsol
Message:
The routine that produce poisson random numbers to decide how many phe
form NSB are emmited in each pixel has been replaced. Now a ROOT routine
is used.
File:
1 edited

Legend:

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

    r436 r438  
    2121//
    2222// $RCSfile: camera.cxx,v $
    23 // $Revision: 1.12 $
    24 // $Author: harald $
    25 // $Date: 2000-09-22 17:40:18 $
     23// $Revision: 1.13 $
     24// $Author: magicsol $
     25// $Date: 2000-10-25 08:14:23 $
    2626//
    2727////////////////////////////////////////////////////////////////////////
     
    4949#include "TROOT.h"
    5050
     51#include "TRandom.h"
    5152#include "TApplication.h"
    5253
     
    692693  if (Write_McTrig){
    693694
    694     McTrig = new MMcTrig* [icontrigger];
     695    McTrig = new MMcTrig * [icontrigger];
    695696 
    696697    for (i=0;i<icontrigger;i++) {
     
    698699    }
    699700
    700     HeaderTrig = new MHeaderTrig* [icontrigger];
     701    HeaderTrig = new MHeaderTrig * [icontrigger];
    701702 
    702703    for (i=0;i<icontrigger;i++) {
     
    740741   
    741742    HeaderTree.Branch("MHeaderTrig","MHeaderTrig",
    742                       &HeaderTrig[0], bsize, split);   
    743   }
    744 
     743                 &HeaderTrig[0], bsize, split);   
     744  }
    745745  if (Trigger_Loop && Write_McTrig){
    746746    for(char branchname[10],i=0;i<icontrigger;i++){
    747       //
    748       //   build the name of the branch for the different trigger conditions
    749       //
     747     
    750748      sprintf(help,"%i",i+1);
    751749      strcpy (branchname, "MHeaderTrig");
    752       strcat (branchname,  &help[0]);
     750      strcat (branchname, & help[0]);
    753751      strcat (branchname, ".");
    754      
    755752      HeaderTree.Branch(branchname,"MHeaderTrig",
    756753                     &HeaderTrig[i], bsize, split);
     
    770767
    771768  }
    772  
    773 
    774769  if(Trigger_Loop && Write_McTrig){
     770
    775771    for (int iconcount=0,ithrescount=0;ithrescount<=Trigger_loop_uthres-Trigger_loop_lthres;ithrescount++){
    776772      for (imulticount=0;imulticount<=Trigger_loop_umult-Trigger_loop_lmult;imulticount++){
     
    789785
    790786  //  Fill the Header Tree with the current leaves of each branch
    791  
    792787  HeaderTree.Fill() ;
    793  
     788           
     789
    794790  //      create a Tree for the Event data stream
    795791  TTree EvtTree("EvtTree","Events of Run");
    796792
    797793  if (Write_McEvt){
     794
    798795    EvtTree.Branch("MMcEvt","MMcEvt",
    799796                   &McEvt, bsize, split); 
     
    801798
    802799  if(!Trigger_Loop){
     800   
    803801    if (Write_RawEvt){
    804802      EvtTree.Branch("MRawEvt","MRawEvt",
     
    810808    }   
    811809  }
    812   else{                     // trigger lopp
     810  else{
    813811    if (Write_McTrig){
    814812      for(char branchname[10],i=0;i<icontrigger;i++){
     
    880878                          &cam,
    881879                          nsbrate_phepns );
    882 
    883880    if (k != 0){
    884881      cout << "Error when reading starfield... \nExiting.\n";
     
    892889        cam.dpixsizefactor[i] * cam.dpixsizefactor[i];
    893890    }
     891
    894892  }
    895893
     
    897895  // Read the reflector file with the Cherenkov data
    898896  //                   
    899  
     897
    900898  // select input file
    901899
    902900  if ( Data_From_STDIN ) {
     901
    903902    inputfile = stdin;
     903
    904904  }
    905905  else{
     
    909909    if ( inputfile == NULL )
    910910      error( SIGNATURE, "Cannot open input file: %s\n", inname );
     911
    911912  }
    912913 
     
    984985
    985986        ++nshow;
    986         if ( fmod ( nshow, 1000. ) == 0. )
    987           log(SIGNATURE, "Event %d(+%d)\n", nshow, ntshow);
     987        log(SIGNATURE, "Event %d(+%d)\n", nshow, ntshow);
    988988       
    989989        // get MCEventHeader
     
    10371037       
    10381038        mcevth.get_deviations ( &thetaCT, &phiCT );
    1039        
     1039
    10401040        if ( (thetaCT == 0.) && (phiCT == 0.) ) {
    10411041         
     
    11341134          exit(1);
    11351135        }
    1136        
    1137         if ( fmod ( nshow, 1000. ) == 0. )   
    1138           log(SIGNATURE, "End of this event: %d cphs(+%d). . .\n",
    1139               ncph, ntcph);
     1136         
     1137        log(SIGNATURE, "End of this event: %d cphs(+%d). . .\n",
     1138            ncph, ntcph);
    11401139
    11411140        ntcph += ncph;
     
    11591158        }
    11601159       
    1161         if ( fmod ( nshow, 1000. ) == 0. )
    1162           log(SIGNATURE, "Total number of phe:  %d \n", inumphe ) ;
     1160        cout << "Total number of phes: " << inumphe <<endl;
    11631161       
    11641162
     
    11751173        // TRIGGER HERE
    11761174
     1175
    11771176        //
    11781177        //   now the noise of the electronic
     
    11871186        if(Trigger_Loop){
    11881187          //  Loop over trigger threshold
    1189           for (int iconcount=0,ithrescount=Trigger_loop_lthres;ithrescount<=Trigger_loop_uthres;ithrescount++) {
     1188          for (int iconcount=0,ithrescount=Trigger_loop_lthres;ithrescount<=Trigger_loop_uthres;ithrescount++){
    11901189            for (i=0;i<TRIGGER_PIXELS;i++)
    11911190              fpixelthres[i]=(float) ithrescount;
    1192 
    11931191            Trigger.SetThreshold(fpixelthres);
     1192
    11941193            Trigger.Diskriminate();
    1195 
    11961194            //
    11971195            //   look if in all the signals in the trigger signal branch
     
    14101408                           (UShort_t) ncph) ;
    14111409            }
    1412 
    14131410            //   We don not count photons out of the camera.   
    1414                    
     1411           
     1412           
    14151413            //
    14161414            //    write it out to the file outfile
    14171415            //
    14181416           
    1419             //EvtTree.Fill() ;
    1420             // huschel
     1417            EvtTree.Fill() ;
     1418           
    14211419         
    14221420         
     
    29732971
    29742972  float t;
     2973  TRandom random;             // Random numbers generator
     2974
     2975  random.SetSeed ((UInt_t) (RandomNumber*1000));
    29752976
    29762977  ii = *inphe; // avoid dereferencing
     
    30283029
    30293030      // randomize
    3030      
    3031       inumnsbphe =  ignpoi( inumnsbphe );
    3032      
     3031
     3032      if (inumnsbphe>0.0){
     3033        inumnsbphe = random.Poisson (inumnsbphe );
     3034      }
     3035
    30333036      // create the photoelectrons
    30343037     
     
    30693072//
    30703073// $Log: not supported by cvs2svn $
     3074// Revision 1.12  2000/09/22 17:40:18  harald
     3075// Added a lot of changes done by oscar.
     3076//
    30713077// Revision 1.11  2000/09/21 11:47:33  harald
    30723078// Oscar found some smaller errors in the calculation of the pixel shape and
    30733079// corrected it.
    30743080//
     3081// $Log: not supported by cvs2svn $
    30753082// Revision 1.10  2000/07/04 14:10:20  MagicSol
    30763083// Some changes have been done in the root output file. The RawEvt tree is only
Note: See TracChangeset for help on using the changeset viewer.