StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
makeCosmicStatus.C
1 /***************************************************************************
2  *
3  * $Id: makeCosmicStatus.C,v 1.1 2012/01/31 08:59:43 sgliske Exp $
4  * Author: C. K. Riley, Nov 2011
5  *
6  ***************************************************************************
7  *
8  * Description: Compute hot strips (and possibly other stuff) for cosmic data
9  * and write to a file
10  *
11  ***************************************************************************
12  *
13  * $Log: makeCosmicStatus.C,v $
14  * Revision 1.1 2012/01/31 08:59:43 sgliske
15  * moved StFgtStatus maker to StFgtPool
16  *
17  * Revision 1.3 2011/12/07 17:17:55 ckriley
18  * minor update
19  *
20  * Revision 1.2 2011/12/01 00:41:34 ckriley
21  * make compatible with db stuff
22  *
23  * Revision 1.1 2011/11/25 20:22:37 ckriley
24  * creation of statusmaker
25  *
26  *
27  *
28  **************************************************************************/
29 
30 // forward declarations
31 class StChain;
32 class StFgtCosmicMaker;
33 class StFgtEvent;
34 class StFgtA2CMaker;
35 class StFgtStatusMaker;
36 
37 StChain *analysisChain = 0;
38 StFgtCosmicMaker *cosmicMkr = 0;
39 StFgtA2CMaker *adcCorrector = 0;
40 StFgtStatusMaker *statusMkr = 0;
41 
42 int makeCosmicStatus( const Char_t *filenameIn = "testfile.sfs",
43  const Char_t *pedfilename = "testfile.Ped.txt",
44  const Char_t *filenameOut = "testfile.Status.txt",
45  Int_t nevents = 199,
46  Short_t timeBin = 4,
47  Bool_t cutShortEvents = 1 ){
48 
49 
50  LoadLibs();
51  Int_t ierr = 0;
52 
53  cout << "Constructing the chain" << endl;
54  analysisChain = new StChain("eemcAnalysisChain");
55 
56  cout << "Constructing the cosmic maker" << endl;
57  cosmicMkr = new StFgtCosmicMaker( "cosmicMaker", filenameIn );
58  cosmicMkr->cutShortEvents( cutShortEvents );
59 
60  Short_t timeBinMask = (1<<timeBin);
61 
62  cout << "Constructing the A2C maker" << endl;
63  adcCorrector = new StFgtA2CMaker( "adcCorrector" );
64  adcCorrector->setPedReaderFile( pedfilename );
65  adcCorrector->setTimeBinMask( timeBinMask );
66  adcCorrector->setAbsThres( -10000 ); // set below -4096 to skip cut
67  adcCorrector->setRelThres( 5 ); // set to zero to skip cut
68  adcCorrector->doRemoveOtherTimeBins( 1 );
69 
70 
71  cout << "Constructing the Status Maker" << endl;
72  statusMkr = new StFgtStatusMaker( "FgtStatusMaker" );
73  statusMkr->setToSaveToDb( 0 );
74  statusMkr->setToSaveToFile( filenameOut );
75 
76  cout << "Initializing" << endl;
77  ierr = analysisChain->Init();
78 
79  if( ierr ){
80  cout << "Error initializing" << endl;
81  return;
82  };
83 
84  if( nevents < 0 )
85  nevents = 1<<30; // a big number
86 
87  cout << "max nevents = " << nevents << endl;
88  for( int i=0; i<nevents && !ierr; ++i ){
89 
90  if( i%1000 == 1 )
91  cout << "\n\nevent number " << i << endl;
92 
93  //cout << "clear" << endl;
94  analysisChain->Clear();
95 
96  //cout << "make" << endl;
97  ierr = analysisChain->Make();
98 
99  };
100 
101  //
102  // Calls the ::Finish() method on all makers
103  //
104  cout << "finish" << endl;
105  analysisChain->Finish();
106 
107  cerr << "\tall done" << endl;
108  return;
109 };
110 
111 
112 // load the shared libraries
113 void LoadLibs() {
114  // common shared libraries
115 
116  gSystem->Load("libPhysics");
117  gSystem->Load("St_base");
118  gSystem->Load("StChain");
119  gSystem->Load("StFgtUtil");
120  gSystem->Load("StUtilities");
121  gSystem->Load("StEvent");
122  cout << "loaded StEvent library" << endl;
123 
124  gSystem->Load("StFgtUtil");
125  gSystem->Load("StFgtRawMaker");
126  gSystem->Load("RTS");
127  gSystem->Load("StFgtPedMaker");
128  gSystem->Load("StFgtStatusMaker");
129  gSystem->Load("StFgtA2CMaker");
130 };
void setRelThres(Float_t thres)
set to below -kFgtMaxAdc (-4096) to skip cut
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual Int_t Make()
Definition: StChain.cxx:110