//STL and C headers #include #include #include #include #include //boost headers #include //ROOT headers #include #include #include #include #include //normal includes #include "../Hits.h" #include "ConfigFile.h" #include "TCevent.h" using namespace std; static bool controlC=false; static int controlCs=0; void signalHandler2(int signal) { if (signal==SIGINT) { cout<<"CTRL + C pressed saving and exiting, press again to abort"<abort" << std::endl; throw; } int main(int argc,char **argv){ using namespace std; signal(SIGINT, signalHandler2); if(!(argc==2)){ cerr<<"Wrong number of arguments, "<FindObject("Hits"); vector detectorPlanes; vector noiseThreshold; //in units of sigma vector a1a2Threshold; vector a0a2Threshold; vector cutMaxU; vector cutMinU; for(int i=0;i<8;++i){ detectorPlanes.push_back(new CsGEMPlane()); /* Reading cuts from configfile */ string s = ""; ostringstream oss; oss<<(i+1); string name="cut"+oss.str(); if(!(cf.readInto(s, name.c_str()) )) failedConf(name.c_str()); istringstream iss(s); double noise,a0a2,a1a2,minU,maxU; iss>>noise>>a1a2>>a0a2>>minU>>maxU; cout<GetBranch("GM01X1__."); TBranch *branchGM01Y1 =inTree->GetBranch("GM01Y1__."); TBranch *branchGM02X1 =inTree->GetBranch("GM02X1__."); TBranch *branchGM02Y1 =inTree->GetBranch("GM02Y1__."); TBranch *branchSI01X1 =inTree->GetBranch("SI01X1__."); TBranch *branchSI01Y1 =inTree->GetBranch("SI01Y1__."); TBranch *branchSI02X1 =inTree->GetBranch("SI02X1__."); TBranch *branchSI02Y1 =inTree->GetBranch("SI02Y1__."); branchGM01X1->SetAddress(&(detectorPlanes.at(0))); branchGM01Y1->SetAddress(&(detectorPlanes.at(1))); branchSI01X1->SetAddress(&(detectorPlanes.at(2))); branchSI01Y1->SetAddress(&(detectorPlanes.at(3))); branchSI02X1->SetAddress(&(detectorPlanes.at(4))); branchSI02Y1->SetAddress(&(detectorPlanes.at(5))); branchGM02X1->SetAddress(&(detectorPlanes.at(6))); branchGM02Y1->SetAddress(&(detectorPlanes.at(7))); int nEvents=inTree->GetEntries(); TCevent* outEvent = new TCevent(); /* outTree will contain events with clusters, no track candidates. */ TFile* outFile = new TFile(outFilePath.c_str(),"RECREATE"); TTree* outTree = new TTree("at_cl","testbench elsa analysis tree"); outTree->Branch("event","TCevent",&outEvent,32000,99); TCalign* a = TCalign::getInstance(alignmentFilePath); a->clear(); a->read(alignmentFilePath); vector nClusters; vector nCuts; int totClusters=0; int totCut=0; int posCut=0; for(int i=0;i<8;++i){ nClusters.push_back(0); nCuts.push_back(0); } TRandom3 rand(0); for(int i_ev=0;i_evGetEntry(i_ev); outEvent->Clear(); vector eventClusters; for(unsigned int i=0;igetPitch(i+1); double res=a->getRes(i+1); //cout<GetName()<::const_iterator it = (detectorPlanes.at(i)->GetClusters()).begin();it!=(detectorPlanes.at(i)->GetClusters()).end();++it){ //cout<<"test"< amps =(*it)->GetAmp(); double amp2=amps.at(2); double amp1=amps.at(1); double amp0=amps.at(0); double ratioA1A2=(amp1+rand.Uniform(-0.5,0.5))/(amp2); double ratioA0A2=(amp0+rand.Uniform(-0.5,0.5))/(amp2); double noise=(*it)->GetNoise(); if((ratioA0A2noiseThreshold.at(i)*noise)){ double x=((*it)->GetPosition())*pitch; if(x>=cutMinU.at(i)&&x<=cutMaxU.at(i)){ TVector3 pos(x,0,0); TVector3 err(0,0,0); if(i>1&&i<7){ err=TVector3(res,0.5,0.1); }else{ err=TVector3(((*it)->GetPositionErr())*pitch,0.5,0.1); } TCcluster _c(pos,err,amp2,(i+1)); eventClusters.push_back(_c); nClusters.at(i)++; totClusters++; // cout<>tmp; */ outEvent->addClusters(eventClusters); outTree->Fill(); }//eventloop end outEvent->Clear(); outFile->Write(); outFile->Close(); for(unsigned int i=0;iclear(); }