/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/analyse/root/monitoring.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1566 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-03-08 14:00:10 +0100 (Thu, 08 Mar 2012) $ */
00002 /* 
00003  * File:   beamProfile.cpp
00004  * Author: jacquem
00005  *
00006  * Created on May 6, 2010, 10:03 AM
00007  */
00008 
00009 // System includes
00010 #include <iostream>
00011 #include <stdlib.h>
00012 #include <map>
00013 #include <string>
00014 
00015 // Root includes
00016 #include "TROOT.h"
00017 #include "TGraph.h"
00018 #include "TStyle.h"
00019 #include <TFile.h>
00020 #include <TTree.h>
00021 #include <TLegend.h>
00022 #include <TKey.h>
00023 #include <TH1I.h>
00024 #include <TH2I.h>
00025 #include <TText.h>
00026 #include <TCanvas.h>
00027 #include <TPaveLabel.h>
00028 
00029 // Framework inlcudes
00030 #include "Run.hh"
00031 #include "Detector.hh"
00032 #include "XMLTool.hh"
00033 #include "Toolbox.hh"
00034 #include "MicroException.hh"
00035 #include "Log.hh"
00036 
00037 #include "root/MTRun.hh"
00038 #include "root/MTEvent.hh"
00039 #include "root/MTChannel.hh"
00040 #include "tools/Arguments.hh"
00041 
00042 #include "Chamber.hh"
00043 #include "Detector.hh"
00044 using namespace std;
00045 
00046 
00047 
00048 int main(int argc, char** argv) {
00049 
00050 
00051   FILELog::ReportingLevel() = FILELog::FromString(INFO);
00052 
00053   Arguments arg(argc,argv,"monitoring inputFile outputFile -l evtNum");
00054   if (arg.getNbOfArgs() != 2 ) { arg.usage() ; exit(-1);}
00055   string rootName = arg.getArgument(1);
00056   string outputFileName = arg.getArgument(2);
00057 
00058   TFile *output= new TFile(outputFileName.c_str(),"RECREATE");
00059 
00060 
00061   Char_t flag[20];
00062   TTree *flagTree = new TTree("FLAG", "evant flag");
00063   flagTree->Branch("Flag", flag,"flag/C");
00064    
00065   vector<TH1I* > dtVec;
00066 
00067  map<unsigned int, map<UInt_t, Float_t>* > tempAsu1Map; // 1rst map, key is DifId , 2nd if Event Number
00068  map<unsigned int, map<UInt_t, Float_t>* > tempAsu2Map; // 1rst map, key is DifId , 2nd if Event Number
00069  map<unsigned int, map<UInt_t, Float_t>* > tempDifMap; // 1rst map, key is DifId , 2nd if Event Number
00070 
00071 
00072   UInt_t eventLimit = 0;
00073   if ( arg.getOption("-l").size() != 0 )
00074   {
00075     eventLimit = atoi(arg.getOption("-l").c_str());
00076   }
00077 
00078   // XY histos
00079   std::map<ui16,TH2I*> xyKeyChamber; // key is chamberId
00080   bool construct = false;
00081 
00082   TFile f(rootName.c_str());
00083 
00084   UInt_t nBoarderEvt = 0;
00085   UInt_t nOnlyFFFF = 0;
00086   UInt_t nOnlyAAAA = 0;
00087   UInt_t nOnly5555 = 0;
00088   UInt_t nCRCError = 0;
00089   UInt_t nBadChipId = 0;
00090   UInt_t nBadBoardId = 0;
00091   UInt_t nBadDifId = 0;
00092   UInt_t nUnknowError = 0;
00093   UInt_t nNotValidEvent = 0;
00094   TH1I validityFlag("Event_validity_flag" ,  "Event validity flag" , 5000,0.5,5000.5);
00095 
00096   
00097   
00098  
00099 
00100   TH2I* xy = NULL;
00101   TIter nextkey(f.GetListOfKeys());
00102   TKey *key;
00103   while (key = (TKey*)nextkey()) 
00104   {
00105     TTree *tree = (TTree*)key->ReadObj();
00106     FILE_LOG(logINFO  ) << "New TTree [" << tree->GetName() << endl;
00107     MTRun *run=NULL;
00108     Detector detector;
00109     try
00110     {
00111       UInt_t runId = 0;
00112       run=dynamic_cast<MTRun *>(tree->GetUserInfo()->First());
00113       if (construct == false)
00114       {
00115         runId = run->GetRunId();
00116         FILE_LOG(logINFO) << "The runId[" << runId << "]" << endl;
00117         if ( runId != 0)
00118         {
00119           if (! Toolbox::getDetector(runId,detector)) { exit(-1);}
00120           // loop over chamber config
00121           ChamberMap_t chambers = detector.getChambers();
00122           for( ChamberMap_t::const_iterator ii=chambers.begin(); ii!=chambers.end(); ++ii)
00123           {
00124             const Chamber& chamber= *((*ii).second);
00125             
00126             string xyname("hxy_");
00127             Toolbox::addIntToString(xyname,chamber.getId());
00128 
00129             string  xytitle("XY distribution of hits in chamber ");
00130             Toolbox::addIntToString(xytitle,chamber.getId());
00131 
00132             FILE_LOG(logINFO) << "Chamber id[" << chamber.getId() << "] , type: " << chamber.getType() << endl;
00133             // create histogram
00134             if ( chamber.getType().compare(MICROROCCHAMBER6) == 0 ) // MICROMEGAS
00135             {                                                   // 1 m -> 1 000 000 um
00136               xy = new TH2I(xyname.c_str(),xytitle.c_str(),193,0,965000,194,0,970000);
00137             }
00138             else if  ( chamber.getType().compare(HARDROC2IPNLCHAMBER6) == 0 ) // RPC
00139             {
00140               Int_t max = 10400*96; // 10400 micro * 96 pad
00141               xy = new TH2I(xyname.c_str(),xytitle.c_str(),96,0,max,96,0,max);
00142             }
00143 
00144             if ( xy != NULL )
00145             {
00146               xy->SetXTitle("y");
00147               xy->SetYTitle("x");
00148             //cout << "Create XY dist for " << xytitle << endl;
00149 
00150             // store it to the map
00151               xyKeyChamber.insert(make_pair(chamber.getId(),xy));
00152             }
00153             else { 
00154             FILE_LOG(logINFO) << "ELSE Chamber id[" << chamber.getId() << "] , type: " << chamber.getType() << endl;
00155             }
00156           }
00157         }
00158       construct = true;
00159       }
00160     }
00161     catch (MicroException e) {}
00162 
00163     MTEvent *evt =  new MTEvent();
00164     TBranch *branch= tree->GetBranch("MTEvent");
00165     branch->SetAddress(&evt);
00166     MTChannel* channel =NULL;
00167     int nbEntries = tree->GetEntries();
00168     if ( eventLimit == 0 ) { eventLimit = nbEntries; }
00169     unsigned int interval = (unsigned int) eventLimit / 10;
00170     if (interval == 0) interval = 1;
00171     for ( int evtNum = 0; evtNum <eventLimit ; evtNum++)
00172     {
00173       tree->GetEntry(evtNum);
00174  
00175       UInt_t nbPads=100;     // input   2/3 du nombre de pad format le cadre d'un asu 1 ASU -> ( 6 chips * 8 pads * 2 cotes + 4 chips * 8 pad * 2 cote ) / 3 * 2
00176       UInt_t asu;            // output
00177       UInt_t abs_time;       // output
00178       UInt_t chamber;       // output
00179 
00180       if ( evt->IsSquare(nbPads,asu,abs_time, chamber) == true ) { nBoarderEvt++; } 
00181       if ( ! evt->IsValid() ) { nNotValidEvent++; }
00182       if ( evt->GetCrcIsCorrect() == false ) 
00183       {
00184         nCRCError++; 
00185       } 
00186 /*
00187 #define VALID               0x1
00188 #define UNKNOW_NOT_VALID    0x2
00189 #define BAD_CHIP_ID         0x4
00190 #define BAD_BOARD_ID        0x8
00191 #define BAD_DIF_ID          0x10
00192 #define CRC_ERROR           0x20
00193 #define ONLY_FFFF           0x40
00194 #define ONLY_AAAA           0x80
00195 #define ONLY_5555           0x100
00196 #define GLOBAL_HEADER_ERROR 0x200
00197 #define FRAME_HEADER_ERROR  0x400
00198 #define TRAILER_C3_FOUND    0x800
00199 #define END_OF_FILE_ERROR   0x1000
00200 */
00201       if ( (evt->GetValidFlag() & VALID) ==  VALID )                              
00202       {
00203         validityFlag.Fill(VALID);
00204         strcpy(flag, "VALID") ;
00205         flagTree->Fill();
00206       }
00207       if ( (evt->GetValidFlag() & UNKNOW_NOT_VALID) ==  UNKNOW_NOT_VALID )        
00208       { 
00209         nUnknowError++;
00210         strcpy(flag, "UNKNOW_NOT_VALID") ;
00211         flagTree->Fill();
00212       }
00213       if ( (evt->GetValidFlag() & ONLY_AAAA) == ONLY_AAAA )                       
00214       {
00215         nOnlyAAAA++;
00216         validityFlag.Fill(ONLY_AAAA);
00217         strcpy(flag, "ONLY_AAAA") ;
00218         flagTree->Fill();
00219       } 
00220       if ( (evt->GetValidFlag() & ONLY_5555) == ONLY_5555 )                       
00221       { 
00222         nOnly5555++; 
00223         validityFlag.Fill(ONLY_5555);
00224         strcpy(flag, "ONLY_5555") ;
00225         flagTree->Fill();
00226       } 
00227       if ( (evt->GetValidFlag() & ONLY_FFFF) == ONLY_FFFF )                       
00228       {
00229          nOnlyFFFF++;validityFlag.Fill(ONLY_FFFF); 
00230         strcpy(flag, "ONLY_FFFF") ;
00231         flagTree->Fill();
00232       }
00233       if ( (evt->GetValidFlag() & BAD_CHIP_ID) ==  BAD_CHIP_ID )                  
00234       { 
00235         nBadChipId++;
00236         strcpy(flag, "BAD_CHIP_ID") ;
00237         flagTree->Fill();
00238         validityFlag.Fill(BAD_CHIP_ID); 
00239       }
00240       if ( (evt->GetValidFlag() & BAD_BOARD_ID) ==  BAD_BOARD_ID )                
00241       {
00242         nBadBoardId++;
00243         strcpy(flag, "BAD_BOARD_ID") ;
00244         flagTree->Fill();
00245         validityFlag.Fill(BAD_BOARD_ID); 
00246       }
00247       if ( (evt->GetValidFlag() & BAD_DIF_ID) ==  BAD_DIF_ID )                    
00248       { 
00249         nBadDifId++;
00250         strcpy(flag, "BAD_DIF_ID") ;
00251         flagTree->Fill();
00252         validityFlag.Fill(BAD_DIF_ID); 
00253       }
00254       if ( (evt->GetValidFlag() & GLOBAL_HEADER_ERROR) ==  GLOBAL_HEADER_ERROR )  
00255       {
00256         validityFlag.Fill(GLOBAL_HEADER_ERROR); 
00257         strcpy(flag, "GLOBAL_HEADER_ERROR") ;
00258         flagTree->Fill();
00259       }
00260       if ( (evt->GetValidFlag() & FRAME_HEADER_ERROR) ==  FRAME_HEADER_ERROR )    
00261       {
00262         validityFlag.Fill(FRAME_HEADER_ERROR);
00263         strcpy(flag, "FRAME_HEADER_ERROR") ;
00264         flagTree->Fill();
00265       }
00266       if ( (evt->GetValidFlag() & TRAILER_C3_FOUND) ==  TRAILER_C3_FOUND )        
00267       {
00268         validityFlag.Fill(TRAILER_C3_FOUND); 
00269         strcpy(flag, "TRAILER_C3_FOUND") ;
00270         flagTree->Fill();
00271       }
00272       if ( (evt->GetValidFlag() & END_OF_FILE_ERROR) ==  END_OF_FILE_ERROR )      
00273       {
00274         validityFlag.Fill(END_OF_FILE_ERROR); 
00275         strcpy(flag, "END_OF_FILE_ERROR") ;
00276         flagTree->Fill();
00277       }
00278       if ( (evt->GetValidFlag() & CRC_ERROR) ==  CRC_ERROR )                        
00279       {
00280         validityFlag.Fill(CRC_ERROR); 
00281         strcpy(flag, "CRC_ERROR") ;
00282         flagTree->Fill();
00283       }
00284 
00285       
00286 
00287 
00288 
00289       map<UInt_t, UInt_t> dtMap; // key is BcIdDif() - BcIdHit. Value is number of entry
00290       UInt_t maxDt = 0;
00291       UInt_t minDt = 0xFFFFFFFF;
00292 
00293       int nbChannel = evt->GetNchannel();
00294       for(int i=0;i<nbChannel  ;i++)
00295       {
00296         channel = (MTChannel*)evt->GetChannels()->UncheckedAt(i);
00297         UInt_t t2 = channel->GetBcIdDif();
00298         UInt_t t3 = channel->GetBcIdHit();
00299         UInt_t dt = t2 - t3;
00300         if ( dt > maxDt ) { maxDt = dt ; }
00301         if ( dt < minDt ) { minDt = dt ; }
00302 
00303 
00304         if (dtMap.find(dt) == dtMap.end())
00305         { //if this dt doesn't exist yet
00306           dtMap.insert(make_pair(dt,1));
00307         }
00308         else
00309         { //if this abs time already exist
00310           dtMap[dt] = dtMap[dt]++;
00311         }
00312 
00313   
00314 
00315         TH2I *hist = xyKeyChamber[channel->GetChamberId()];
00316         if ( hist ) 
00317         {
00318           if ( detector.getChamberById(channel->GetChamberId()).getType().compare(MICROROCCHAMBER6) == 0 ) // MICROMEGAS
00319           {
00320               hist->Fill(channel->GetY() + 2500,channel->GetX()+2500,channel->GetDigitalValue());
00321               hist->Fill(channel->GetY()+2500,channel->GetX()-2500,channel->GetDigitalValue());
00322               hist->Fill(channel->GetY()-2500,channel->GetX()+2500,channel->GetDigitalValue());
00323               hist->Fill(channel->GetY()-2500,channel->GetX()-2500,channel->GetDigitalValue());
00324           }
00325           else if ( detector.getChamberById(channel->GetChamberId()).getType().compare(HARDROC2IPNLCHAMBER6) == 0 ) 
00326           { 
00327               hist->Fill(channel->GetY(),channel->GetX(),channel->GetDigitalValue());
00328           }
00329 
00330         }
00331       }
00332       
00333       if ( evtNum % interval == 0 )
00334       {
00335         //cout << "Min Dt[" << minDt <<  "], maxDt[" << maxDt << "]" << flush;
00336         string name = "dt_" ;
00337         name = name + tree->GetName();
00338         Toolbox::addIntToString(name,evtNum);
00339         string title = "BcIdDif - BcIdHit";
00340         TH1I *dtHist = new TH1I(name.c_str(),title.c_str(), maxDt-minDt,  0 ,maxDt);
00341         
00342         name = "dt_projection";
00343         name = name + tree->GetName();
00344         Toolbox::addIntToString(name,evtNum);
00345 
00346         TH1I *dtProjHist = new TH1I(name.c_str(),title.c_str(), nbChannel,  0 ,nbChannel);
00347         for ( map<UInt_t ,UInt_t>::const_iterator iterC = dtMap.begin(); iterC != dtMap.end(); iterC++)
00348         {
00349           Int_t val = (*iterC).second;
00350           dtHist->Fill((*iterC).first,val);
00351           dtProjHist->Fill(val);
00352         }
00353         dtVec.push_back(dtHist);
00354         dtVec.push_back(dtProjHist);
00355       }
00356 
00357       // Asu1, 2 and Dif temperature
00358       const map<unsigned int , float>& tempAsu1EvtMap = evt->GetTemperatureAsu1();
00359       const map<unsigned int , float>& tempAsu2EvtMap = evt->GetTemperatureAsu2();
00360       const map<unsigned int , float>& tempDifEvtMap = evt->GetTemperatureDif();
00361 
00362       for ( map<unsigned int , float>::const_iterator it = tempAsu1EvtMap.begin() ; it != tempAsu1EvtMap.end(); it++)
00363       {
00364         unsigned int difId = it->first ;
00365         float asu1temp = it->second;
00366         float asu2temp = tempAsu2EvtMap.find(difId)->second;
00367         float diftemp = tempDifEvtMap.find(difId)->second;
00368       //if ( difId == 89 ) cout << "eventId[" << evtNum << "], asu1temp[" << asu1temp << "],asu2temp[" << asu2temp << "],difTemp[" << diftemp << "]"<< endl;
00369 
00370         map<UInt_t , Float_t>* foo = NULL;
00371         if ( tempAsu1Map.find(difId) == tempAsu1Map.end())
00372         {
00373           foo = new map<UInt_t , Float_t>();
00374           tempAsu1Map.insert(make_pair(difId,new map<UInt_t , Float_t>()));
00375           tempAsu2Map.insert(make_pair(difId,new map<UInt_t , Float_t>()));
00376           tempDifMap.insert(make_pair(difId,new map<UInt_t , Float_t>()));
00377         }
00378         if ( asu1temp != 0. ) (tempAsu1Map.find(difId)->second)->insert(make_pair(evtNum,asu1temp));
00379         if ( asu2temp != 0. ) (tempAsu2Map.find(difId)->second)->insert(make_pair(evtNum,asu2temp));
00380         if ( diftemp != 0. ) (tempDifMap.find(difId)->second)->insert(make_pair(evtNum,diftemp));
00381       }
00382 
00383       FILE_LOG(logINFO  ) << "Write Event[" << evtNum << "] \t\t\t\t\t\t\t\t\t\t\t\r" << flush;
00384     }
00385  }
00386 
00387 
00388 
00389 
00390    //TCanvas *statistic = new TCanvas("statistic", "statistic",100,10,700,500);
00391    TCanvas *statistic = new TCanvas("statistic", "statistic",100,10,400,300);
00392    statistic->Range(0,0,20,24);
00393    statistic->SetFillColor(10);
00394    statistic->SetBorderSize(4);
00395 
00396    TPaveLabel *pl = new TPaveLabel(3,22,17,23.7, "Monitoring result","br");
00397    pl->SetFillColor(18);
00398    pl->Draw();
00399 
00400    TText t(0,0,"a");
00401    t.SetTextFont(62);
00402    t.SetTextSize(0.025);
00403    t.SetTextAlign(12);
00404 
00405    string msg = "Total of not valid Event: ";
00406    Toolbox::addIntToString(msg,   nNotValidEvent); msg = msg + ( " / "); Toolbox::addIntToString(msg,   eventLimit );
00407    float p = float(float(nNotValidEvent) / float( eventLimit) * 100 );
00408    msg = msg + ( "-> "); Toolbox::addFloatToString(msg,  p ); msg = msg + ( "% ");
00409    t.DrawText(2,20,msg.c_str());
00410 
00411    msg = "Number of Event with CRC incorrect: ";
00412    Toolbox::addIntToString(msg,   nCRCError); msg = msg + ( " / "); Toolbox::addIntToString(msg,   eventLimit );
00413    p = float(float(nCRCError) / float( eventLimit) * 100 );
00414    msg = msg + ( "-> "); Toolbox::addFloatToString(msg, p ); msg = msg + ( "% ");
00415    t.DrawText(2,18,msg.c_str());
00416    
00417    msg = "Number of not valid Event because of  bad chip id: ";
00418    Toolbox::addIntToString(msg,   nBadChipId); msg = msg + ( " / "); Toolbox::addIntToString(msg,   eventLimit );
00419    p = float(float(nBadChipId) / float( eventLimit) * 100 );
00420    msg = msg + ( "-> "); Toolbox::addFloatToString(msg,  p ); msg = msg + ( "% ");
00421    t.DrawText(2,16,msg.c_str());
00422 
00423    msg = "Number of not valid Event because of unknow error: ";
00424    Toolbox::addIntToString(msg,   nUnknowError); msg = msg + ( " / "); Toolbox::addIntToString(msg,   eventLimit );
00425    p = float(float(nUnknowError) / float( eventLimit) * 100 );
00426    msg = msg + ( "-> "); Toolbox::addFloatToString(msg,  p ); msg = msg + ( "% ");
00427    t.DrawText(2,14,msg.c_str());
00428 
00429    msg = "Number of Event with  only FFFF as data ";
00430    Toolbox::addIntToString(msg,   nOnlyFFFF); msg = msg + ( " / "); Toolbox::addIntToString(msg,   eventLimit );
00431    p = float(float(nOnlyFFFF) / float( eventLimit) * 100 );
00432    msg = msg + ( "-> "); Toolbox::addFloatToString(msg,  p ); msg = msg + ( "% ");
00433    t.DrawText(2,12,msg.c_str());
00434 
00435 
00436    msg = "Number of Event with  only AAAA as data ";
00437    Toolbox::addIntToString(msg,   nOnlyAAAA); msg = msg + ( " / "); Toolbox::addIntToString(msg,   eventLimit );
00438    p = float(float(nOnlyAAAA) / float( eventLimit) * 100 );
00439    msg = msg + ( "-> "); Toolbox::addFloatToString(msg,  p ); msg = msg + ( "% ");
00440    t.DrawText(2,10,msg.c_str());
00441 
00442    msg = "Number of boarder Event (with  a least 100 boarder pad): ";
00443    Toolbox::addIntToString(msg,   nBoarderEvt); msg = msg + ( " / "); Toolbox::addIntToString(msg,   eventLimit );
00444    p = float(float(nBoarderEvt) / float( eventLimit) * 100 );
00445    msg = msg + ( "-> "); Toolbox::addFloatToString(msg,  p ); msg = msg + ( "% ");
00446    t.DrawText(2,8,msg.c_str());
00447 
00448    statistic->cd();
00449    output->cd();
00450 
00451   for ( map<ui16,TH2I*>::const_iterator iterC = xyKeyChamber.begin(); iterC != xyKeyChamber.end(); iterC++)
00452   {
00453     TH2I *hist = (*iterC).second;
00454     if ( hist )  
00455     {  
00456       hist->Write();
00457     } 
00458   }
00459 
00460  
00461   TCanvas deltaT("deltatT");
00462   double racine = sqrt(dtVec.size());
00463   UInt_t intSqrt = (UInt_t)(racine+1);
00464 
00465   deltaT.Divide(intSqrt,intSqrt);
00466   
00467   UInt_t index = 1;
00468 
00469   for (vector<TH1I* >::const_iterator iterC = dtVec.begin(); iterC != dtVec.end(); iterC++)
00470   {
00471     TH1I *hist = *iterC;
00472     if ( hist )
00473     { 
00474       if ( index % 2 == 0) deltaT.GetPad(index)->SetLogx();
00475       deltaT.GetPad(index)->SetLogy();
00476       deltaT.cd(index);
00477       index++;
00478       hist->Draw();
00479       hist->Write();
00480     }
00481   }
00482 
00483   
00484   for ( map<unsigned int,map< UInt_t, Float_t>*>::const_iterator iterC = tempAsu1Map.begin(); iterC != tempAsu1Map.end(); iterC++)
00485   {
00486     UInt_t difId = (*iterC).first;
00487     string title("temperature_dif_");
00488     Toolbox::addIntToString(title,difId);
00489     TCanvas temperature(title.c_str());
00490     temperature.Divide(1,3);
00491 
00492     map<UInt_t, Float_t>* asu1 = (*iterC).second;
00493     map<UInt_t, Float_t> *asu2 = tempAsu2Map.find(difId)->second;
00494     map<UInt_t, Float_t> *dif = tempDifMap.find(difId)->second;
00495     
00496     
00497     UInt_t n = asu1->size();
00498     Float_t xAsu1[n], yAsu1[n];
00499     Float_t xAsu2[n], yAsu2[n];
00500     Float_t xDif[n], yDif[n];
00501     index = 0;
00502     if ( asu1 )  
00503     {
00504       for ( map< UInt_t, Float_t>::const_iterator iterTemp = asu1->begin(); iterTemp != asu1->end(); iterTemp++)
00505       {   
00506         UInt_t eventId = (*iterTemp).first; 
00507         xAsu1[index] = eventId;
00508         yAsu1[index] = (*iterTemp).second;
00509         xAsu2[index] = eventId;
00510         yAsu2[index] = asu2->find(eventId)->second;
00511         xDif[index] = eventId;
00512         yDif[index] = dif->find(eventId)->second;
00513 //      if ( difId == 89 ) cout << "yAsu1[index][" << yAsu1[index] << "],yAsu2[index][" << yAsu2[index] << "],yDif[index][" << yDif[index] << "]"<< endl;
00514         index++;
00515       }
00516       temperature.cd(1);
00517       TGraph *gr1 = new TGraph(n,xAsu1,yAsu1);
00518       gr1->SetTitle("Asu 1 temperature");
00519       gr1->Draw("AL");
00520       temperature.cd(2);
00521       TGraph *gr2 = new TGraph(n,xAsu2,yAsu2);
00522       gr2->SetTitle("Asu 2 temperature");
00523       gr2->Draw("AL");
00524       temperature.cd(3);
00525       TGraph *grd = new TGraph(n,xDif,yDif);
00526       grd->SetTitle("Dif temperature");
00527       grd->Draw("AL");
00528     } 
00529     
00530   
00531     //if ( asu2 )  {  temperature.cd(2); asu2->Draw(); } 
00532     //if ( dif )  {  temperature.cd(3); dif->Draw(); } 
00533     temperature.Write();
00534   }
00535 
00536 
00537   statistic->Write();
00538   deltaT.Write();
00539 
00540   flagTree->SetFillColor(45);
00541   TCanvas flagCanvas("eventFlags", "event flag value");
00542   flagCanvas.SetFillColor(42);
00543   flagCanvas.SetGrid();
00544   flagCanvas.SetLogx();
00545   flagCanvas.SetFrameFillColor(33);
00546   flagTree->Draw("Flag","", "hbar2");
00547   flagCanvas.Write();
00548 
00549   output->Close();
00550   f.Close(); 
00551 
00552   cout <<endl << endl << "Done" << endl;
00553   
00554 return 0;
00555 }
00556 
00557 
00558   
00559 

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7