| 1 |
formato |
1.1 |
// C/C++ headers |
| 2 |
|
|
// |
| 3 |
|
|
#include <fstream> |
| 4 |
|
|
#include <string.h> |
| 5 |
|
|
#include <iostream> |
| 6 |
|
|
#include <stdio.h> |
| 7 |
|
|
#include <ctype.h> |
| 8 |
|
|
|
| 9 |
|
|
// |
| 10 |
|
|
// ROOT headers |
| 11 |
|
|
// |
| 12 |
|
|
|
| 13 |
|
|
#include <TTree.h> |
| 14 |
|
|
|
| 15 |
|
|
#include <TSystem.h> |
| 16 |
|
|
#include <TStopwatch.h> |
| 17 |
|
|
#include <TSystemDirectory.h> |
| 18 |
|
|
#include <TGraphAsymmErrors.h> |
| 19 |
|
|
#include <TString.h> |
| 20 |
|
|
#include <TFile.h> |
| 21 |
|
|
#include <TClass.h> |
| 22 |
|
|
#include <TGraph.h> |
| 23 |
|
|
#include <TLine.h> |
| 24 |
|
|
#include <TH1F.h> |
| 25 |
|
|
#include <TMath.h> |
| 26 |
|
|
#include <TRandom3.h> |
| 27 |
|
|
#include <TF1.h> |
| 28 |
|
|
// |
| 29 |
|
|
// RunInfo header |
| 30 |
|
|
// |
| 31 |
|
|
#include <RunInfo.h> |
| 32 |
|
|
#include <PamLevel2.h> |
| 33 |
|
|
#include <TClonesArray.h> |
| 34 |
|
|
|
| 35 |
|
|
#include "PamCut/PamCutEnv.h" |
| 36 |
|
|
#include <VKmask.h> |
| 37 |
|
|
|
| 38 |
|
|
//PamVMC headers |
| 39 |
|
|
#include "PamVMCDigMgr.h" |
| 40 |
|
|
#include "PamVMCTrkHit.h" |
| 41 |
|
|
#include "PamVMCTrkF77GpsSpe.h" |
| 42 |
|
|
#include "PamVMCPrimaryGenerator.h" |
| 43 |
|
|
using namespace std; |
| 44 |
|
|
//This program is standalone Digitizer for PamVMC |
| 45 |
|
|
|
| 46 |
|
|
|
| 47 |
|
|
void Usage (); |
| 48 |
|
|
|
| 49 |
|
|
TClonesArray* FindColl(TTree*t, TString brname, TString type = "PamVMCDetectorHit"); |
| 50 |
|
|
void RegisterPDG(); |
| 51 |
|
|
//Here user should define all nuclei and particles that are not in PDG tabe of ROOT |
| 52 |
|
|
//otherwise application will crash on TOF digitization whrer charge information needed; |
| 53 |
|
|
|
| 54 |
|
|
void UnCompressCalo(TClonesArray* cal_comp, TClonesArray & cal_u); |
| 55 |
|
|
|
| 56 |
|
|
//This will make a list of arrays 12X3X8 for each mask |
| 57 |
|
|
//It run once on Initialization stage |
| 58 |
|
|
Bool_t **** MakeBoolOfMasks( TList* msk_in_list ); |
| 59 |
|
|
|
| 60 |
|
|
|
| 61 |
|
|
void KillBadStrips(pGPSSPEHits * hits_in, pGPSSPEHits * hits_out, Bool_t****m_msk, cGPSSPE* out, TList *msk_lst, Int_t cutoff_bin); |
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
void ApplyMask( pGPSSPEHits * hits_in, cGPSSPE* out, Bool_t *** mask); |
| 65 |
|
|
Bool_t IsStripXGood( Int_t istrip, Int_t npstrip, Int_t ntstrip, Bool_t *** mask); |
| 66 |
|
|
Bool_t IsStripYGood( Int_t istrip, Int_t npstrip, Int_t ntstrip, Bool_t *** mask); |
| 67 |
|
|
|
| 68 |
|
|
|
| 69 |
|
|
int main(int argc, char * argv[] ){ |
| 70 |
|
|
|
| 71 |
|
|
|
| 72 |
|
|
if(argc!=5){ |
| 73 |
|
|
Usage(); |
| 74 |
|
|
return 0; |
| 75 |
|
|
} |
| 76 |
|
|
|
| 77 |
|
|
TString DataPATH = gSystem->Getenv("PWD"); |
| 78 |
|
|
TString inputfilename(argv[1]); |
| 79 |
|
|
if(!inputfilename.Contains(".root")){ |
| 80 |
|
|
cerr<<"Error! Not root file on input!"<<endl; |
| 81 |
|
|
return 0; |
| 82 |
|
|
} |
| 83 |
|
|
|
| 84 |
|
|
TString outputfilename(argv[2]); |
| 85 |
|
|
|
| 86 |
|
|
TStopwatch timer; |
| 87 |
|
|
timer.Start(); |
| 88 |
|
|
TFile* rfin = new TFile(inputfilename, "UPDATE"); |
| 89 |
|
|
if(!rfin){ |
| 90 |
|
|
cerr<<"Error! Can't read root file with hits collections!"<<endl; |
| 91 |
|
|
return 0; |
| 92 |
|
|
} |
| 93 |
|
|
|
| 94 |
|
|
TString masksfilename(argv[3]); |
| 95 |
|
|
TFile* rfmasks = new TFile( masksfilename ); |
| 96 |
|
|
if(!rfmasks){ |
| 97 |
|
|
cerr<<"Error! Can't read root file with masks!"<<endl; |
| 98 |
|
|
return 0; |
| 99 |
|
|
} |
| 100 |
|
|
|
| 101 |
|
|
TList *msk_list = (TList*)rfmasks->Get("masks"); |
| 102 |
|
|
Bool_t ****m_msk = MakeBoolOfMasks( msk_list ); |
| 103 |
|
|
|
| 104 |
|
|
|
| 105 |
|
|
TString cutoff_b_s(argv[4]); |
| 106 |
|
|
Int_t cutoff_bin = cutoff_b_s.Atoi(); |
| 107 |
|
|
|
| 108 |
|
|
TTree::SetMaxTreeSize(1000*Long64_t(2000000000)); |
| 109 |
|
|
|
| 110 |
|
|
TTree * hits_tree = (TTree*)rfin->Get("hits"); |
| 111 |
|
|
if(!hits_tree){ |
| 112 |
|
|
cerr<<"Tree hits are not found in file "<<rfin->GetName()<<endl; |
| 113 |
|
|
TString treename = rfin->GetName(); |
| 114 |
|
|
treename.Replace(treename.Index(".root",5),5,""); |
| 115 |
|
|
hits_tree = (TTree*)rfin->Get(treename); |
| 116 |
|
|
if(!hits_tree) return 0; |
| 117 |
|
|
} |
| 118 |
|
|
|
| 119 |
|
|
TObjArray * frndArr = new TObjArray(); |
| 120 |
|
|
hits_tree->SetBranchAddress("RNDM",&frndArr); |
| 121 |
|
|
|
| 122 |
|
|
PamVMCRndMgr* rnd_mgr = PamVMCRndMgr::Instance_ext(); |
| 123 |
|
|
cout<<"dmdr"<<endl; |
| 124 |
|
|
PamVMCDigMgr* d_mgr = PamVMCDigMgr::Instance_ext(); |
| 125 |
|
|
cout<<"dmdr"<<endl; |
| 126 |
|
|
|
| 127 |
|
|
//AC CARD: C1D1, C2D1, CAT: TOP1, CAS: SID1 |
| 128 |
|
|
PamVMCAcDig* ac = new PamVMCAcDig(); |
| 129 |
|
|
ac->RegisterCollections("C1D1", FindColl(hits_tree,"C1D1")); |
| 130 |
|
|
ac->RegisterCollections("C2D1", FindColl(hits_tree,"C2D1")); |
| 131 |
|
|
ac->RegisterCollections("TOP1", FindColl(hits_tree,"TOP1")); |
| 132 |
|
|
ac->RegisterCollections("SID1", FindColl(hits_tree,"SID1")); |
| 133 |
|
|
|
| 134 |
|
|
//TOF: S11Y, S12X, S21X, S22Y, S31Y, S32X |
| 135 |
|
|
PamVMCTofDig* tof = new PamVMCTofDig(); |
| 136 |
|
|
tof->RegisterCollections("S11Y", FindColl(hits_tree,"S11Y")); |
| 137 |
|
|
tof->RegisterCollections("S12X", FindColl(hits_tree,"S12X")); |
| 138 |
|
|
tof->RegisterCollections("S21X", FindColl(hits_tree,"S21X")); |
| 139 |
|
|
tof->RegisterCollections("S22Y", FindColl(hits_tree,"S22Y")); |
| 140 |
|
|
tof->RegisterCollections("S31Y", FindColl(hits_tree,"S31Y")); |
| 141 |
|
|
tof->RegisterCollections("S32X", FindColl(hits_tree,"S32X")); |
| 142 |
|
|
|
| 143 |
|
|
|
| 144 |
|
|
//Calorimeter CAST |
| 145 |
|
|
#define NSTRIPS 4224 |
| 146 |
|
|
PamVMCCaloDig* cal = new PamVMCCaloDig(); |
| 147 |
|
|
TClonesArray *cal_u = new TClonesArray("PamVMCDetectorHit",NSTRIPS); //uncompressed array |
| 148 |
|
|
TClonesArray* cal_comp = FindColl(hits_tree,"CAST"); // compressed array from file |
| 149 |
|
|
cal->RegisterCollections("CAST", cal_u); |
| 150 |
|
|
|
| 151 |
|
|
//Tracker GPSSPE |
| 152 |
|
|
PamVMCTrkDig* trk = new PamVMCTrkDig(); |
| 153 |
|
|
TBranch *gps = hits_tree->GetBranch("GPSSPE"); |
| 154 |
|
|
trk->RegisterCollections("TSPA", FindColl(hits_tree,"TSPA")); |
| 155 |
|
|
pGPSSPEHits * hits_in = new pGPSSPEHits(); |
| 156 |
|
|
pGPSSPEHits * hits_out = new pGPSSPEHits(); |
| 157 |
|
|
cGPSSPE* out = new cGPSSPE(); |
| 158 |
|
|
if(gps){ |
| 159 |
|
|
hits_tree->SetBranchAddress("GPSSPE",&hits_in); |
| 160 |
|
|
hits_tree->SetBranchStatus("GPSSPE",1); |
| 161 |
|
|
cout<<"TRKCOLL="<<hits_in<<endl; |
| 162 |
|
|
trk->RegisterTrkData(hits_out); |
| 163 |
|
|
} |
| 164 |
|
|
|
| 165 |
|
|
|
| 166 |
|
|
//S4 |
| 167 |
|
|
PamVMCS4Dig* s4 = new PamVMCS4Dig(); |
| 168 |
|
|
s4->RegisterCollections("S4", FindColl(hits_tree,"S4")); |
| 169 |
|
|
|
| 170 |
|
|
//ND: NDTI |
| 171 |
|
|
PamVMCNDDig* nd = new PamVMCNDDig(); |
| 172 |
|
|
nd->RegisterCollections("NDTI", FindColl(hits_tree,"NDTI")); |
| 173 |
|
|
|
| 174 |
|
|
|
| 175 |
|
|
//Primaries |
| 176 |
|
|
TClonesArray *prims = FindColl(hits_tree,"PRIM","PamVMCPrimary"); |
| 177 |
|
|
|
| 178 |
|
|
//Initialization |
| 179 |
|
|
d_mgr->SetDIG("Tof",tof); |
| 180 |
|
|
d_mgr->SetDIG("AC",ac); |
| 181 |
|
|
d_mgr->SetDIG("CAST",cal); |
| 182 |
|
|
d_mgr->SetDIG("TSPA",trk); |
| 183 |
|
|
d_mgr->SetDIG("S4",s4); |
| 184 |
|
|
d_mgr->SetDIG("NDTI",nd); |
| 185 |
|
|
|
| 186 |
|
|
//Random for masks extraction |
| 187 |
|
|
gRandom = new TRandom3(0); |
| 188 |
|
|
|
| 189 |
|
|
d_mgr->Initialize( new TRandom3(0)); //Load Calibrations and set dummy random |
| 190 |
|
|
|
| 191 |
|
|
PamVMCRawMgr* r_mgr = PamVMCRawMgr::Instance(); |
| 192 |
|
|
r_mgr->CreateOutFile(outputfilename.Data()); |
| 193 |
|
|
|
| 194 |
|
|
r_mgr->WriteToFile(); |
| 195 |
|
|
|
| 196 |
|
|
Int_t nev = hits_tree->GetEntries(); |
| 197 |
|
|
cout<<"TOTAL NUMBER OF EVENTS:"<<nev<<endl; |
| 198 |
|
|
RegisterPDG(); |
| 199 |
|
|
//Event loop |
| 200 |
|
|
d_mgr->PrintCollections(); |
| 201 |
|
|
for(Int_t i = 0; i<nev; i++){ |
| 202 |
|
|
hits_tree->GetEntry(i); |
| 203 |
|
|
cout<<"--> Setting Random"<<endl; |
| 204 |
|
|
for(Int_t j = 0; j<frndArr->GetEntries(); j++){ |
| 205 |
|
|
TRandom3 * rnd = (TRandom3*)frndArr->At(j); |
| 206 |
|
|
TString nm = rnd->GetName(); |
| 207 |
|
|
if ( nm=="AC" ) ac->SetRandom(rnd); |
| 208 |
|
|
if ( nm=="Calo" ) cal->SetRandom(rnd); |
| 209 |
|
|
if ( nm=="Tracker" ) trk->SetRandom(rnd); |
| 210 |
|
|
if ( nm=="S4" ) s4->SetRandom(rnd); |
| 211 |
|
|
if ( nm=="Tof" ) tof->SetRandom(rnd); |
| 212 |
|
|
if ( nm=="ND" ) nd->SetRandom(rnd); |
| 213 |
|
|
} |
| 214 |
|
|
|
| 215 |
|
|
cout<<"--> Digitizing evnt"<<endl; |
| 216 |
|
|
UnCompressCalo(cal_comp, *cal_u); |
| 217 |
|
|
KillBadStrips( hits_in, hits_out, m_msk, out, msk_list, cutoff_bin); |
| 218 |
|
|
d_mgr->Digitize(((PamVMCPrimary*)prims->At(0))->fID,((PamVMCPrimary*)prims->At(0))->fPDG); |
| 219 |
|
|
cout<<"--> Writing evnt"<<endl; |
| 220 |
|
|
r_mgr->WriteEvent(); |
| 221 |
|
|
rnd_mgr->ClearColl(); |
| 222 |
|
|
} |
| 223 |
|
|
|
| 224 |
|
|
r_mgr->FinishRun(); |
| 225 |
|
|
d_mgr->PrintCollections(); |
| 226 |
|
|
timer.Stop(); |
| 227 |
|
|
gDirectory->Delete("tmp.root"); |
| 228 |
|
|
rfin->Close(); |
| 229 |
|
|
return 0; |
| 230 |
|
|
} |
| 231 |
|
|
|
| 232 |
|
|
TClonesArray* FindColl(TTree*t, TString brname, TString type){ |
| 233 |
|
|
if(t->GetBranch(brname)){ |
| 234 |
|
|
TClonesArray* coll = 0;//new TClonesArray(type,4224); |
| 235 |
|
|
t->GetBranch(brname)->SetAddress(&coll); |
| 236 |
|
|
cout<<"coll="<<coll<<endl; |
| 237 |
|
|
return coll; |
| 238 |
|
|
} |
| 239 |
|
|
return 0; |
| 240 |
|
|
} |
| 241 |
|
|
|
| 242 |
|
|
void RegisterPDG(){ |
| 243 |
|
|
TDatabasePDG::Instance()->AddParticle("H-2","H-2",1.875613,kTRUE,0., 3. /* |e|/3 charge*/,"Ion",1000010020); |
| 244 |
|
|
TDatabasePDG::Instance()->AddParticle("H-3","H-3",2.808921,kTRUE,0., 3. /* |e|/3 charge*/,"Ion",1000010030); |
| 245 |
|
|
TDatabasePDG::Instance()->AddParticle("He-4","He-4",3.727379,kTRUE,0., 6. /* |e|/3 charge*/,"Ion",1000020040); |
| 246 |
|
|
TDatabasePDG::Instance()->AddParticle("He-3","He-3",2.808391,kTRUE,0., 6. /* |e|/3 charge*/,"Ion",1000020030); |
| 247 |
|
|
|
| 248 |
|
|
Double_t gev = 0.93146;// conversion a.m.u. to gev; |
| 249 |
|
|
|
| 250 |
|
|
//nuclei and other stuff |
| 251 |
|
|
TDatabasePDG::Instance()->AddParticle("Li-6","Li-6",6.015122*gev,kTRUE,0., 9. /* |e|/3 charge*/,"Ion",1000030060); |
| 252 |
|
|
TDatabasePDG::Instance()->AddParticle("Li-7","Li-7",7.016004*gev,kTRUE,0., 9. /* |e|/3 charge*/,"Ion",1000030070); |
| 253 |
|
|
TDatabasePDG::Instance()->AddParticle("Be-7","Be-7",7.01692983*gev,kTRUE,0., 12. /* |e|/3 charge*/,"Ion",1000040070); |
| 254 |
|
|
TDatabasePDG::Instance()->AddParticle("Be-9","Be-9",9.0121822*gev,kTRUE,0., 12. /* |e|/3 charge*/,"Ion",1000040090); |
| 255 |
|
|
TDatabasePDG::Instance()->AddParticle("Be-10","Be-10",10.013533818*gev,kTRUE,0., 12. /* |e|/3 charge*/,"Ion",1000040100); |
| 256 |
|
|
TDatabasePDG::Instance()->AddParticle("B-10","B-10",10.0129370*gev,kTRUE,0., 15. /* |e|/3 charge*/,"Ion",1000050100); |
| 257 |
|
|
TDatabasePDG::Instance()->AddParticle("B-11","B-11",11.0093054*gev,kTRUE,0., 15. /* |e|/3 charge*/,"Ion",1000050110); |
| 258 |
|
|
TDatabasePDG::Instance()->AddParticle("C-12","C-12",12.*gev,kTRUE,0., 18. /* |e|/3 charge*/,"Ion",1000060120); |
| 259 |
|
|
TDatabasePDG::Instance()->AddParticle("N-14","N-14",14.0030740048*gev,kTRUE,0., 21. /* |e|/3 charge*/,"Ion",1000070140); |
| 260 |
|
|
TDatabasePDG::Instance()->AddParticle("O-16","O-16",15.99491461956*gev,kTRUE,0., 23. /* |e|/3 charge*/,"Ion",1000080160); |
| 261 |
|
|
} |
| 262 |
|
|
|
| 263 |
|
|
void UnCompressCalo(TClonesArray* cal_comp, TClonesArray & cal_u){ |
| 264 |
|
|
if(!cal_comp) return; |
| 265 |
|
|
PamVMCDetectorHit* hit = NULL; |
| 266 |
|
|
PamVMCDetectorHit* newhit = NULL; |
| 267 |
|
|
cal_u.Clear("C"); |
| 268 |
|
|
for(Int_t j = 0; j<cal_comp->GetEntries(); j++){ |
| 269 |
|
|
hit=((PamVMCDetectorHit*)cal_comp->At(j)); |
| 270 |
|
|
newhit = (PamVMCDetectorHit*)cal_u.New(hit->GetPOS()); |
| 271 |
|
|
*newhit = *hit; |
| 272 |
|
|
} |
| 273 |
|
|
} |
| 274 |
|
|
|
| 275 |
|
|
void KillBadStrips(pGPSSPEHits * hits_in, pGPSSPEHits * hits_out, Bool_t****m_msk, cGPSSPE* out, TList *msk_lst, Int_t cutoff_bin){ |
| 276 |
|
|
|
| 277 |
|
|
hits_out->Clean(); |
| 278 |
|
|
|
| 279 |
|
|
//First I have to do is extract random mask |
| 280 |
|
|
TH2D* prof_2d = (TH2D*)msk_lst->At(msk_lst->GetEntries()-1); |
| 281 |
|
|
TH1D* prof_1d = (TH1D*)prof_2d->ProjectionY("prof_1d",cutoff_bin, cutoff_bin+1); |
| 282 |
|
|
Int_t mask_id = prof_1d->FindBin( prof_1d->GetRandom() ); |
| 283 |
|
|
|
| 284 |
|
|
Bool_t*** msk = m_msk[ mask_id - 1]; |
| 285 |
|
|
|
| 286 |
|
|
ApplyMask( hits_in, out, msk ); |
| 287 |
|
|
hits_out->SetData( out ); |
| 288 |
|
|
|
| 289 |
|
|
cout<<"X-view: before:"<<hits_in->GetNXHit()<<", after:"<<hits_out->GetNXHit() |
| 290 |
|
|
<<"Y-view: before:"<<hits_in->GetNYHit()<<", after:"<<hits_out->GetNYHit()<<endl; |
| 291 |
|
|
} |
| 292 |
|
|
|
| 293 |
|
|
|
| 294 |
|
|
void ApplyMask( pGPSSPEHits * hits_in, cGPSSPE* out, Bool_t *** mask){ |
| 295 |
|
|
|
| 296 |
|
|
out->nstrpx = out->nstrpy = 0; |
| 297 |
|
|
|
| 298 |
|
|
for(Int_t k = 0; k<hits_in->GetNXHit(); k++){ |
| 299 |
|
|
GPSSPEData * in_data = hits_in->GetXHit( k ); |
| 300 |
|
|
if (IsStripXGood( in_data->fistrip, in_data->fnpstrip, in_data->fntstrip, mask)){ |
| 301 |
|
|
out->qstripx[out->nstrpx] = in_data->fqstrip; |
| 302 |
|
|
out->xstripx[out->nstrpx] = in_data->fstripc; |
| 303 |
|
|
out->npstripx[out->nstrpx] = in_data->fnpstrip; |
| 304 |
|
|
out->ntstripx[out->nstrpx] = in_data->fntstrip; |
| 305 |
|
|
out->istripx[out->nstrpx] = in_data->fistrip; |
| 306 |
|
|
out->nstrpx++; |
| 307 |
|
|
} |
| 308 |
|
|
} |
| 309 |
|
|
|
| 310 |
|
|
for(Int_t k = 0; k<hits_in->GetNYHit(); k++){ |
| 311 |
|
|
GPSSPEData * in_data = hits_in->GetYHit( k ); |
| 312 |
|
|
if (IsStripYGood( in_data->fistrip, in_data->fnpstrip, in_data->fntstrip, mask)){ |
| 313 |
|
|
out->qstripy[out->nstrpy] = in_data->fqstrip; |
| 314 |
|
|
out->ystripy[out->nstrpy] = in_data->fstripc; |
| 315 |
|
|
out->npstripy[out->nstrpy] = in_data->fnpstrip; |
| 316 |
|
|
out->ntstripy[out->nstrpy] = in_data->fntstrip; |
| 317 |
|
|
out->istripy[out->nstrpy] = in_data->fistrip; |
| 318 |
|
|
out->nstrpy++; |
| 319 |
|
|
} |
| 320 |
|
|
} |
| 321 |
|
|
} |
| 322 |
|
|
|
| 323 |
|
|
Bool_t IsStripXGood( Int_t istrip, Int_t npstrip, Int_t ntstrip, Bool_t *** mask){ |
| 324 |
|
|
|
| 325 |
|
|
Int_t iladd = -1; |
| 326 |
|
|
Int_t iv = (npstrip-1)*2 + 1; |
| 327 |
|
|
if( (ntstrip==1) || (ntstrip==4)) iladd = 0; //1 F |
| 328 |
|
|
if( (ntstrip==2) || (ntstrip==5)) iladd = 1; //2 F |
| 329 |
|
|
if( (ntstrip==3) || (ntstrip==6)) iladd = 2; //3 F |
| 330 |
|
|
Int_t j_strip = 2*( istrip - iladd*1024 ); |
| 331 |
|
|
Int_t ivkl = Int_t( (j_strip/2. - 1)/128. ); |
| 332 |
|
|
return mask[iv][iladd][ivkl]; //0..11, 0..2, 0..7 |
| 333 |
|
|
|
| 334 |
|
|
} |
| 335 |
|
|
|
| 336 |
|
|
Bool_t IsStripYGood( Int_t istrip, Int_t npstrip, Int_t ntstrip, Bool_t *** mask){ |
| 337 |
|
|
|
| 338 |
|
|
Int_t iladd = -1; |
| 339 |
|
|
Int_t iv = (npstrip-1)*2; |
| 340 |
|
|
if( (ntstrip==1) || (ntstrip==4)) iladd = 0; //1 F |
| 341 |
|
|
if( (ntstrip==2) || (ntstrip==5)) iladd = 1; //2 F |
| 342 |
|
|
if( (ntstrip==3) || (ntstrip==6)) iladd = 2; //3 F |
| 343 |
|
|
Int_t j_strip = istrip - iladd*1024; |
| 344 |
|
|
Int_t ivkl = Int_t( (j_strip - 1)/128. ); |
| 345 |
|
|
return mask[iv][iladd][ivkl]; //0..11, 0..2, 0..7 |
| 346 |
|
|
|
| 347 |
|
|
} |
| 348 |
|
|
|
| 349 |
|
|
Bool_t **** MakeBoolOfMasks( TList* msk_in_list ){ |
| 350 |
|
|
|
| 351 |
|
|
Bool_t ****m_msk = new Bool_t***[msk_in_list->GetEntries() - 1]; |
| 352 |
|
|
for(Int_t m = 0; m<msk_in_list->GetEntries() - 1; m++){ |
| 353 |
|
|
Bool_t ***vk_matrix = new Bool_t**[12]; |
| 354 |
|
|
for(Int_t i=0; i<12; ++i){ |
| 355 |
|
|
vk_matrix[i] = new Bool_t*[3]; |
| 356 |
|
|
for(Int_t j=0; j<3; ++j) |
| 357 |
|
|
vk_matrix[i][j] = new Bool_t[8]; |
| 358 |
|
|
} |
| 359 |
|
|
|
| 360 |
|
|
VKmask * msk = (VKmask*)msk_in_list->At(m); |
| 361 |
|
|
msk->GetMaskBool( vk_matrix ); |
| 362 |
|
|
m_msk[m] = vk_matrix; |
| 363 |
|
|
|
| 364 |
|
|
//Print given mask |
| 365 |
|
|
cout<<"--->MASK "<<m<<" printout: "<<endl; |
| 366 |
|
|
for(Int_t i=0; i<12; ++i){ |
| 367 |
|
|
for(Int_t j=0; j<3; ++j){ |
| 368 |
|
|
for(Int_t k=0; k<8; ++k){ |
| 369 |
|
|
cout<<vk_matrix[i][j][k]<<" "; |
| 370 |
|
|
} |
| 371 |
|
|
} |
| 372 |
|
|
cout<< msk->GetMaskRow(i)<<endl; |
| 373 |
|
|
} |
| 374 |
|
|
|
| 375 |
|
|
cout<<"<--- END OF MASK "<<m<<endl; |
| 376 |
|
|
} |
| 377 |
|
|
|
| 378 |
|
|
return m_msk; |
| 379 |
|
|
} |
| 380 |
|
|
|
| 381 |
|
|
|
| 382 |
|
|
void Usage(){ |
| 383 |
|
|
cout<<"NAME"<<endl; |
| 384 |
|
|
cout<<" vmc_dig - a standalone digitizer for PamVMC application"<<endl; |
| 385 |
|
|
cout<<"SYNOPSIS"<<endl; |
| 386 |
|
|
cout<<" vmc_dig INPROOTFILE OUTRAWFILE MASKSPROFILE IBIN"<<endl; |
| 387 |
|
|
cout<<"DISCRIPTION"<<endl; |
| 388 |
|
|
cout<<" This tool convert hits collections of PamVMC in raw format "<<endl; |
| 389 |
|
|
cout<<" There are only 4 parameters: input root/output raw filenames,"<<endl; |
| 390 |
|
|
cout<<" input root-file with list of VKmask objects + TH2D histogram, "<<endl; |
| 391 |
|
|
cout<<" and bin number which should be taken from TH2D to do masks profile. "<<endl; |
| 392 |
|
|
cout<<" Please note that your input file should contain RNDM branch"<<endl; |
| 393 |
|
|
cout<<" ( produced with <all_detectors/> option in <save_mode> section )"<<endl; |
| 394 |
|
|
} |