Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:57

0001 #include "Read_DST.hh"
0002 
0003 void Read_DST(int run_num = 50889
0004               /*const string &input_file = "/sphenix/tg/tg01/commissioning/INTT/data/dst_files/2024/DST_beam_intt-00041892_no_hot_special.root"*/,
0005           int event_num = 100,
0006           int fphx_bco = 63 )
0007 {
0008   //gSystem->ListLibraries();
0009 
0010   Fun4AllServer *se = Fun4AllServer::instance();
0011   se->Verbosity( 0 );
0012   recoConsts *rc = recoConsts::instance();
0013 
0014   //Enable::MVTX = true;
0015   Enable::INTT = true;
0016   Enable::GLOBAL_RECO = true;
0017   
0018   //===============
0019   // conditions DB flags
0020   //===============
0021   Enable::CDB = true;
0022   // global tag
0023   rc->set_StringFlag("CDB_GLOBALTAG", CDB::global_tag);
0024   // 64 bit timestamp
0025   rc->set_uint64Flag("TIMESTAMP", CDB::timestamp);
0026   rc->set_IntFlag("RUNNUMBER", run_num );
0027 
0028   // TrkrHit reconstructions
0029   // Mvtx_Cells();
0030   // Load ActsGeometry object
0031   TrackingInit();
0032   
0033   Fun4AllDstInputManager *in = new Fun4AllDstInputManager("Dst");
0034 
0035   string dst_file = "";
0036   string list = string("list_") + to_string( run_num ) + ".txt";
0037   
0038   if( run_num == 50889 ) // steaming mode
0039     {
0040       // DST_physics_intt-00050889_no_hot_FPHX_BCO_100.root
0041       dst_file = string("data/DST_physics_intt-00050889_no_hot_FPHX_BCO_") + to_string(fphx_bco) + ".root";
0042       in->fileopen( dst_file );  
0043     }
0044   else if( run_num == 50377 ) // triggered mode
0045     {
0046       cout << "DST list: " << list << endl;
0047       in->AddListFile( list );
0048     }
0049 
0050   se->registerInputManager(in);
0051 
0052   InttXYVertexFinder* intt_xy = new InttXYVertexFinder();
0053   //  intt_xy->SetOutDirectory( "./results" ); // not implemented yet
0054   intt_xy->EnableQA( true );
0055   intt_xy->SetBeamCenter(-0.0188185, 0.198181);
0056   // se->registerSubsystem( intt_xy );
0057 
0058   InttZVertexFinder* intt_z = new InttZVertexFinder();
0059   intt_z->SetOutDirectory( "./results" );
0060   intt_z->EnableQA( true );
0061   intt_z->SetBeamCenter(-0.0188185, 0.198181);  // 1st 10k version
0062   //  intt_z->Verbosity( 0 );
0063   se->registerSubsystem( intt_z );
0064 
0065   // Learn https://github.com/ChengWeiShih/coldQCD_code/blob/main/ForwardCaloNtuplizer/macro/Fun4All_ForwardCalo.C or something there 
0066   MbdReco* mbd_reco = new MbdReco();
0067   se->registerSubsystem( mbd_reco );
0068   
0069   GlobalVertexReco* global_vertex = new GlobalVertexReco();
0070   se->registerSubsystem( global_vertex );
0071   
0072   string output = "results/InttAna_run" + to_string( run_num );
0073   if( run_num == 50889 )
0074     output += "_FPHX_BCO_" + to_string( fphx_bco );
0075 
0076   output += ".root";
0077   
0078   InttAna *inttana = new InttAna( "InttAna", output );
0079   inttana->Verbosity( 1 ); // 0: minimum, 1: some, 2: detailed
0080   //inttana->SetBeamCenter(-0.0188185, 0.198181);  // 1st 10k version
0081   se->registerSubsystem( inttana );
0082 
0083   // Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out","test.root");
0084   // se->registerOutputManager(out);
0085 
0086   int skip_num = 0;
0087   if( run_num == 50889 )
0088     {
0089       //   0: not work
0090       //   5: not work
0091       //  10: good
0092       //  15: good
0093       //  20: 
0094       //  25:
0095       //  30:
0096       //  35:
0097       //  40:
0098       //  45:
0099       //  50
0100 
0101       //  80:
0102       //  85:
0103       //  90:
0104       //  95:
0105       // 100:
0106       // 105: 
0107       // 110: good
0108       // 115: by skipping ~27000 events, 72385 events can be processed
0109       // 120: good
0110       /*
0111       if( fphx_bco == 12 )
0112     {
0113       skip_num = 1500 ;
0114       event_num = 100000;
0115     }
0116       else if( fphx_bco == 13 ) // give up...
0117     {
0118       //se->skip( 2500 );
0119       //event_num = 100000;
0120     }
0121       else if( fphx_bco == 19 ) 
0122     {
0123       //      se->skip( 5074 );
0124       //event_num = 100000;
0125     }
0126       else if( fphx_bco == 20 )
0127     {
0128       if( event_num == 0 )
0129         event_num = 73426;
0130 
0131       skip_num = 5074 ;
0132     }
0133       else if( fphx_bco == 63 )
0134     {
0135       //se->skip( 9117 ); // to skip the strange event
0136       //se->skip( 9117 + 5303 ); // to skip the strange event
0137     }
0138       else if( fphx_bco == 105 )
0139     skip_num = 80304 ;
0140       else if( fphx_bco == 115 )
0141     skip_num = 13489 + 14125 ;
0142       else
0143     skip_num = 1000 ;
0144       */
0145       
0146     }
0147   else if( run_num == 50377 )
0148     {
0149       skip_num = 250 ;
0150     }
0151 
0152   se->skip( skip_num );
0153   se->run( event_num );
0154 
0155   se->End();
0156   delete se;
0157   //  gSystem->Exit(0);
0158   return;
0159 }